@@ -22,7 +22,7 @@ import (
22
22
)
23
23
24
24
type ACDConfig struct {
25
- ArgoCDAutoSyncEnabled bool `env:"ARGO_AUTO_SYNC_ENABLED" envDefault:"true"` //will gradually switch this flag to false in enterprise
25
+ ArgoCDAutoSyncEnabled bool `env:"ARGO_AUTO_SYNC_ENABLED" envDefault:"true"` // will gradually switch this flag to false in enterprise
26
26
}
27
27
28
28
func GetACDDeploymentConfig () (* ACDConfig , error ) {
@@ -54,6 +54,9 @@ type ArgoClientWrapperService interface {
54
54
// PatchArgoCdApp performs a patch operation on an argoCd app
55
55
PatchArgoCdApp (ctx context.Context , dto * bean.ArgoCdAppPatchReqDto ) error
56
56
57
+ // IsArgoAppPatchRequired decides weather the v1alpha1.ApplicationSource requires to be updated
58
+ IsArgoAppPatchRequired (argoAppSpec * v1alpha1.ApplicationSource , currentGitRepoUrl , currentChartPath string ) bool
59
+
57
60
// GetGitOpsRepoName returns the GitOps repository name, configured for the argoCd app
58
61
GetGitOpsRepoName (ctx context.Context , appName string ) (gitOpsRepoName string , err error )
59
62
}
@@ -180,6 +183,12 @@ func (impl *ArgoClientWrapperServiceImpl) GetArgoAppByName(ctx context.Context,
180
183
return argoApplication , nil
181
184
}
182
185
186
+ func (impl * ArgoClientWrapperServiceImpl ) IsArgoAppPatchRequired (argoAppSpec * v1alpha1.ApplicationSource , currentGitRepoUrl , currentChartPath string ) bool {
187
+ return (len (currentGitRepoUrl ) != 0 && argoAppSpec .RepoURL != currentGitRepoUrl ) ||
188
+ argoAppSpec .Path != currentChartPath ||
189
+ argoAppSpec .TargetRevision != bean .TargetRevisionMaster
190
+ }
191
+
183
192
func (impl * ArgoClientWrapperServiceImpl ) PatchArgoCdApp (ctx context.Context , dto * bean.ArgoCdAppPatchReqDto ) error {
184
193
patchReq := adapter .GetArgoCdPatchReqFromDto (dto )
185
194
reqbyte , err := json .Marshal (patchReq )
0 commit comments