{"modulePath":"github.com/devtron-labs/devtron","version":"v1.8.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\n## Constants\n\n```go\nconst (\n\tHTTP_URL_PROTOCOL            = \"http://\"\n\tHTTPS_URL_PROTOCOL           = \"https://\"\n\tBITBUCKET_CLONE_BASE_URL     = \"https://bitbucket.org/\"\n\tBITBUCKET_GITOPS_DIR         = \"bitbucketGitOps\"\n\tBITBUCKET_COMMIT_TIME_LAYOUT = \"2001-01-01T10:00:00+00:00\"\n)\n```\n\n```go\nconst PushErrorMessage = \"failed to push some refs\"\n```\n\n## Variables\n\n```go\nvar BitbucketRepoNotFoundError = fmt.Errorf(\"404 Not Found\")\n```\n\n## Functions\n\n```go\nfunc CreateGitlabClient(host, token string, tlsConfig *tls.Config) (*gitlab.Client, error)\n```\n\n```go\nfunc GetGitConfigAll(gitOpsConfigReadService config.GitOpsConfigReadService) ([]*bean.GitConfig, error)\n```\n\n```go\nfunc IsRepoNotFound(err error) bool\n```\n\n```go\nfunc SanitiseCustomGitRepoURL(activeGitOpsConfig *apiGitOpsBean.GitOpsConfigDto, gitRepoURL string) (sanitisedGitRepoURL string)\n```\nSanitiseCustomGitRepoURL - It will sanitise the user given repository url based on GitOps provider\n\nCase BITBUCKET\\_PROVIDER:\n\n  - The clone URL format https://\\\u003cuser-name\u003e@bitbucket.org/\\\u003cworkspace-name\u003e/\\\u003crepo-name\u003e.git\n  - Here the \\\u003cuser-name\u003e can differ from user to user. SanitiseCustomGitRepoURL will return the repo url in format : [https://bitbucket.org/](https://bitbucket.org/)\\\u003cworkspace-name\u003e/\\\u003crepo-name\u003e.git\n\nCase AZURE\\_DEVOPS\\_PROVIDER:\n\n  - The clone URL format https://\\\u003corganisation-name\u003e@dev.azure.com/\\\u003corganisation-name\u003e/\\\u003cproject-name\u003e/\\_git/\\\u003crepo-name\u003e\n  - Here the \\\u003cuser-name\u003e can differ from user to user. SanitiseCustomGitRepoURL will return the repo url in format : [https://dev.azure.com/](https://dev.azure.com/)\\\u003corganisation-name\u003e/\\\u003cproject-name\u003e/\\_git/\\\u003crepo-name\u003e\n\n## Types\n\n```go\ntype ChartConfig struct {\n\tChartName      string\n\tChartLocation  string\n\tFileName       string //filename\n\tFileContent    string\n\tReleaseMessage string\n\tChartRepoName  string\n\tTargetRevision string\n\t// UseDefaultBranch will override the TargetRevision and use the default branch of the repo\n\t// This is currently implemented for the bitbucket client only.\n\t// This is used to create the first commit on default branch.\n\tUseDefaultBranch bool\n\tUserName         string\n\tUserEmailId      string\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (c *ChartConfig) GetBitBucketBaseDir() string\n```\n\n```go\nfunc (c *ChartConfig) SetBitBucketBaseDir(dir string)\n```\n\n```go\ntype ClientHelperObject struct {\n\tConfig *bean.GitConfig\n}\n```\n\n```go\ntype DetailedErrorGitOpsConfigActions struct {\n\tSuccessfulStages []string         `json:\"successfulStages\"`\n\tStageErrorMap    map[string]error `json:\"stageErrorMap\"`\n\tValidatedOn      time.Time        `json:\"validatedOn\"`\n\tDeleteRepoFailed bool             `json:\"deleteRepoFailed\"`\n}\n```\n\n```go\ntype GitAzureClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGitAzureClient(token string, host string, project string, logger *zap.SugaredLogger, gitOpsHelper *GitOpsHelper, tlsConfig *tls.Config) (GitAzureClient, error)\n```\n\n```go\nfunc (impl GitAzureClient) CommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *bean2.GitOpsConfigDto, publishStatusConflictError bool) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (impl GitAzureClient) CreateFirstCommitOnHead(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitAzureClient) CreateReadme(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitAzureClient) CreateRepository(ctx context.Context, config *bean2.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n```\n\n```go\nfunc (impl GitAzureClient) DeleteRepository(config *bean2.GitOpsConfigDto) (err error)\n```\n\n```go\nfunc (impl GitAzureClient) GetRepoUrl(config *bean2.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n```\n\n```go\ntype GitBitbucketClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGitBitbucketClient(username, token, host string, logger *zap.SugaredLogger, gitOpsHelper *GitOpsHelper, tlsConfig *tls.Config) GitBitbucketClient\n```\n\n```go\nfunc (impl GitBitbucketClient) CommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *bean2.GitOpsConfigDto, publishStatusConflictError bool) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (impl GitBitbucketClient) CreateFirstCommitOnHead(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitBitbucketClient) CreateReadme(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitBitbucketClient) CreateRepository(ctx context.Context, config *bean2.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n```\n\n```go\nfunc (impl GitBitbucketClient) DeleteRepository(config *bean2.GitOpsConfigDto) (err error)\n```\n\n```go\nfunc (impl GitBitbucketClient) GetRepoUrl(config *bean2.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n```\n\n```go\ntype GitFactory struct {\n\tClient       GitOpsClient\n\tGitOpsHelper *GitOpsHelper\n\n\tClientHelperMap map[string]*ClientHelperObject\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGitFactory(logger *zap.SugaredLogger, gitOpsConfigReadService config.GitOpsConfigReadService) (*GitFactory, error)\n```\n\n```go\nfunc (factory *GitFactory) GetGitLabGroupPath(gitOpsConfig *gitOps.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (factory *GitFactory) NewClientForValidation(gitOpsConfig *gitOps.GitOpsConfigDto) (GitOpsClient, *GitOpsHelper, error)\n```\n\n```go\nfunc (factory *GitFactory) Reload(gitOpsConfigReadService config.GitOpsConfigReadService) (err error)\n```\n\n```go\ntype GitHubClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGithubClient(host string, token string, org string, logger *zap.SugaredLogger,\n\tgitOpsHelper *GitOpsHelper, tlsConfig *tls.Config) (GitHubClient, error)\n```\n\n```go\nfunc (impl GitHubClient) CommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *bean2.GitOpsConfigDto, publishStatusConflictErrorMetrics bool) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (impl GitHubClient) CreateFirstCommitOnHead(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitHubClient) CreateReadme(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitHubClient) CreateRepository(ctx context.Context, config *bean2.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n```\n\n```go\nfunc (impl GitHubClient) DeleteRepository(config *bean2.GitOpsConfigDto) error\n```\n\n```go\nfunc (impl GitHubClient) GetRepoUrl(config *bean2.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n```\n\n```go\ntype GitLabClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (impl GitLabClient) CommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *bean2.GitOpsConfigDto, publishStatusConflictError bool) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (impl GitLabClient) CreateFirstCommitOnHead(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitLabClient) CreateReadme(ctx context.Context, config *bean2.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (impl GitLabClient) CreateRepository(ctx context.Context, config *bean2.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n```\n\n```go\nfunc (impl GitLabClient) DeleteProject(projectName string) (err error)\n```\n\n```go\nfunc (impl GitLabClient) DeleteRepository(config *bean2.GitOpsConfigDto) (err error)\n```\n\n```go\nfunc (impl GitLabClient) GetRepoUrl(config *bean2.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n```\n\n```go\ntype GitOperationService interface {\n\tCreateGitRepositoryForDevtronApp(ctx context.Context, gitOpsRepoName string, targetRevision string, userId int32) (chartGitAttribute *commonBean.ChartGitAttribute, err error)\n\t// CreateFirstCommitOnHead - creates the first commit on the head of the git repository (mostly empty).\n\t// To register the git repository in ArgoCD, there should be a commit HEAD on the default branch.\n\tCreateFirstCommitOnHead(ctx context.Context, gitOpsRepoName string, userId int32) error\n\tGitPull(clonedDir string, repoUrl string, targetRevision string) error\n\n\tCommitValues(ctx context.Context, chartGitAttr *ChartConfig) (commitHash string, commitTime time.Time, err error)\n\tPushChartToGitRepo(ctx context.Context, gitOpsRepoName, chartLocation, tempReferenceTemplateDir, repoUrl, targetRevision string, userId int32) (err error)\n\tCloneChartForHelmApp(helmAppName, gitRepoUrl, targetRevision string) (string, error)\n\tPushChartToGitOpsRepoForHelmApp(ctx context.Context, pushChartToGitRequest *bean.PushChartToGitRequestDTO, valuesConfig *ChartConfig) (*commonBean.ChartGitAttribute, string, error)\n\n\tCreateRepository(ctx context.Context, dto *apiBean.GitOpsConfigDto, userId int32) (string, bool, bool, error)\n\n\tGetClonedDir(ctx context.Context, chartDir, repoUrl, targetRevision string) (string, error)\n\tReloadGitOpsProvider() error\n\tUpdateGitHostUrlByProvider(request *apiBean.GitOpsConfigDto) error\n\tGetRepoUrlWithUserName(url string) (string, error)\n}\n```\n\n```go\ntype GitOperationServiceImpl struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGitOperationServiceImpl(logger *zap.SugaredLogger, gitFactory *GitFactory,\n\tgitOpsConfigReadService config.GitOpsConfigReadService,\n\tchartTemplateService util.ChartTemplateService,\n\tenvVariables *globalUtil.EnvironmentVariables) *GitOperationServiceImpl\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) CloneChartForHelmApp(helmAppName, gitRepoUrl, targetRevision string) (string, error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) CommitValues(ctx context.Context, chartGitAttr *ChartConfig) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) CreateFirstCommitOnHead(ctx context.Context, gitOpsRepoName string, userId int32) error\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) CreateGitRepositoryForDevtronApp(ctx context.Context, gitOpsRepoName string, targetRevision string, userId int32) (chartGitAttribute *commonBean.ChartGitAttribute, err error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) CreateRepository(ctx context.Context, dto *apiBean.GitOpsConfigDto, userId int32) (string, bool, bool, error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) GetClonedDir(ctx context.Context, chartDir, repoUrl, targetRevision string) (string, error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) GetRepoUrlWithUserName(url string) (string, error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) GitPull(clonedDir string, repoUrl string, targetRevision string) error\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) PushChartToGitOpsRepoForHelmApp(ctx context.Context, pushChartToGitRequest *bean.PushChartToGitRequestDTO, valuesConfig *ChartConfig) (*commonBean.ChartGitAttribute, string, error)\n```\nPushChartToGitOpsRepoForHelmApp pushes built chart to GitOps repo (Specific implementation for Helm Apps) TODO refactoring: Make a common method for both PushChartToGitRepo and PushChartToGitOpsRepoForHelmApp\n\n```go\nfunc (impl *GitOperationServiceImpl) PushChartToGitRepo(ctx context.Context, gitOpsRepoName, chartLocation, tempReferenceTemplateDir, repoUrl, targetRevision string, userId int32) (err error)\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) ReloadGitOpsProvider() error\n```\n\n```go\nfunc (impl *GitOperationServiceImpl) UpdateGitHostUrlByProvider(request *apiBean.GitOpsConfigDto) error\n```\n\n```go\ntype GitOpsClient interface {\n\tCreateRepository(ctx context.Context, config *gitOps.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n\tCommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *gitOps.GitOpsConfigDto, publishStatusConflictError bool) (commitHash string, commitTime time.Time, err error)\n\tGetRepoUrl(config *gitOps.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n\tDeleteRepository(config *gitOps.GitOpsConfigDto) error\n\tCreateReadme(ctx context.Context, config *gitOps.GitOpsConfigDto) (string, error)\n\t// CreateFirstCommitOnHead creates a commit on the HEAD of the repository, used for initializing the repository.\n\t// It is used when the repository is empty and needs an initial commit.\n\tCreateFirstCommitOnHead(ctx context.Context, config *gitOps.GitOpsConfigDto) (string, error)\n}\n```\n\n```go\nfunc NewGitLabClient(config *bean.GitConfig, logger *zap.SugaredLogger, gitOpsHelper *GitOpsHelper, tlsConfig *tls.Config) (GitOpsClient, error)\n```\n\n```go\nfunc NewGitOpsClient(config *bean.GitConfig, logger *zap.SugaredLogger, gitOpsHelper *GitOpsHelper) (GitOpsClient, error)\n```\n\n```go\ntype GitOpsHelper struct {\n\tAuth *git.BasicAuth\n\t// contains filtered or unexported fields\n}\n```\nGitOpsHelper GitOps Helper maintains the auth creds in state and is used by implementation of git client implementations and GitFactory\n\n```go\nfunc NewGitOpsHelperImpl(auth *git.BasicAuth, logger *zap.SugaredLogger, tlsConfig *bean.TLSConfig, isTlsEnabled bool) (*GitOpsHelper, error)\n```\n\n```go\nfunc (impl *GitOpsHelper) Clone(url, targetDir, targetRevision string) (clonedDir string, err error)\n```\n\n```go\nfunc (impl *GitOpsHelper) CommitAndPushAllChanges(ctx context.Context, repoRoot, targetRevision, commitMsg, name, emailId string) (commitHash string, err error)\n```\n\n```go\nfunc (impl *GitOpsHelper) GetCloneDirectory(targetDir string) (clonedDir string)\n```\n\n```go\nfunc (impl *GitOpsHelper) Pull(repoRoot, targetRevision string) (err error)\n```\n\n```go\nfunc (impl *GitOpsHelper) SetAuth(auth *git.BasicAuth)\n```\n\n```go\ntype UnimplementedGitOpsClient struct{}\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) CommitValues(ctx context.Context, config *ChartConfig, gitOpsConfig *gitOps.GitOpsConfigDto, publishStatusConflictError bool) (commitHash string, commitTime time.Time, err error)\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) CreateFirstCommitOnHead(ctx context.Context, config *gitOps.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) CreateReadme(ctx context.Context, config *gitOps.GitOpsConfigDto) (string, error)\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) CreateRepository(ctx context.Context, config *gitOps.GitOpsConfigDto) (url string, isNew bool, isEmpty bool, detailedErrorGitOpsConfigActions DetailedErrorGitOpsConfigActions)\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) DeleteRepository(config *gitOps.GitOpsConfigDto) error\n```\n\n```go\nfunc (u *UnimplementedGitOpsClient) GetRepoUrl(config *gitOps.GitOpsConfigDto) (repoUrl string, isRepoEmpty bool, err error)\n```\n\n","path":"github.com/devtron-labs/devtron/pkg/deployment/gitOps/git","name":"git","synopsis":"","isRedistributable":true}
