Skip to content

Commit 9cb524d

Browse files
removed code for gitops repo migration in devtron apps (#4838)
Co-authored-by: Vikram <[email protected]>
1 parent 907142d commit 9cb524d

File tree

3 files changed

+19
-44
lines changed

3 files changed

+19
-44
lines changed

pkg/app/ManifestPushService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (impl *GitOpsManifestPushServiceImpl) PushChart(manifestPushTemplate *bean.
106106
return manifestPushResponse
107107
}
108108
// 3. Create Git Repo if required
109-
if gitOps.IsGitOpsRepoNotConfigured(manifestPushTemplate.RepoUrl) || manifestPushTemplate.GitOpsRepoMigrationRequired {
109+
if gitOps.IsGitOpsRepoNotConfigured(manifestPushTemplate.RepoUrl) {
110110
overRiddenGitRepoUrl, errMsg := impl.migrateRepoForGitOperation(*manifestPushTemplate, ctx)
111111
if errMsg != nil {
112112
manifestPushResponse.Error = errMsg

pkg/app/bean/ManifestPushTemplate.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,24 @@ const WORKFLOW_EXIST_ERROR = "workflow with this name already exist in this app"
66
const Workflows = "workflows"
77

88
type ManifestPushTemplate struct {
9-
WorkflowRunnerId int
10-
AppId int
11-
ChartRefId int
12-
EnvironmentId int
13-
EnvironmentName string
14-
UserId int32
15-
PipelineOverrideId int
16-
AppName string
17-
TargetEnvironmentName int
18-
ChartReferenceTemplate string
19-
ChartName string
20-
ChartVersion string
21-
ChartLocation string
22-
RepoUrl string
23-
IsCustomGitRepository bool
24-
GitOpsRepoMigrationRequired bool
25-
BuiltChartPath string
26-
BuiltChartBytes *[]byte
27-
MergedValues string
9+
WorkflowRunnerId int
10+
AppId int
11+
ChartRefId int
12+
EnvironmentId int
13+
EnvironmentName string
14+
UserId int32
15+
PipelineOverrideId int
16+
AppName string
17+
TargetEnvironmentName int
18+
ChartReferenceTemplate string
19+
ChartName string
20+
ChartVersion string
21+
ChartLocation string
22+
RepoUrl string
23+
IsCustomGitRepository bool
24+
BuiltChartPath string
25+
BuiltChartBytes *[]byte
26+
MergedValues string
2827
}
2928

3029
type ManifestPushResponse struct {

pkg/deployment/trigger/devtronApps/TriggerService.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -839,34 +839,10 @@ func (impl *TriggerServiceImpl) buildManifestPushTemplate(overrideRequest *bean3
839839
manifestPushTemplate.ChartLocation = valuesOverrideResponse.EnvOverride.Chart.ChartLocation
840840
manifestPushTemplate.RepoUrl = valuesOverrideResponse.EnvOverride.Chart.GitRepoUrl
841841
manifestPushTemplate.IsCustomGitRepository = valuesOverrideResponse.EnvOverride.Chart.IsCustomGitRepository
842-
manifestPushTemplate.GitOpsRepoMigrationRequired = impl.checkIfRepoMigrationRequired(manifestPushTemplate)
843842
}
844843
return manifestPushTemplate, err
845844
}
846845

847-
// checkIfRepoMigrationRequired checks if gitOps repo name is changed
848-
func (impl *TriggerServiceImpl) checkIfRepoMigrationRequired(manifestPushTemplate *bean4.ManifestPushTemplate) bool {
849-
monoRepoMigrationRequired := false
850-
if gitOps.IsGitOpsRepoNotConfigured(manifestPushTemplate.RepoUrl) || manifestPushTemplate.IsCustomGitRepository {
851-
return false
852-
}
853-
var err error
854-
gitOpsRepoName := impl.gitOpsConfigReadService.GetGitOpsRepoNameFromUrl(manifestPushTemplate.RepoUrl)
855-
if len(gitOpsRepoName) == 0 {
856-
gitOpsRepoName, err = impl.getAcdAppGitOpsRepoName(manifestPushTemplate.AppName, manifestPushTemplate.EnvironmentName)
857-
if err != nil || gitOpsRepoName == "" {
858-
return false
859-
}
860-
}
861-
//here will set new git repo name if required to migrate
862-
newGitOpsRepoName := impl.gitOpsConfigReadService.GetGitOpsRepoName(manifestPushTemplate.AppName)
863-
//checking weather git repo migration needed or not, if existing git repo and new independent git repo is not same than go ahead with migration
864-
if newGitOpsRepoName != gitOpsRepoName {
865-
monoRepoMigrationRequired = true
866-
}
867-
return monoRepoMigrationRequired
868-
}
869-
870846
// getAcdAppGitOpsRepoName returns the GitOps repository name, configured for the argoCd app
871847
func (impl *TriggerServiceImpl) getAcdAppGitOpsRepoName(appName string, environmentName string) (string, error) {
872848
//this method should only call in case of argo-integration and gitops configured

0 commit comments

Comments
 (0)