Skip to content

Commit

Permalink
move settings fetch outside loop
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Dec 6, 2022
1 parent d9e1825 commit 6fb63a6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions util/argo/argo.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,15 @@ func verifyGenerateManifests(
Message: errDestinationMissing,
})
}
// If source is Kustomize add build options
kustomizeSettings, err := settingsMgr.GetKustomizeSettings()
if err != nil {
conditions = append(conditions, argoappv1.ApplicationCondition{
Type: argoappv1.ApplicationConditionInvalidSpecError,
Message: fmt.Sprintf("Error getting Kustomize settings: %v", err),
})
return conditions // Can't perform the next check without settings.
}

for _, source := range sources {
repoRes, err := db.GetRepository(ctx, source.RepoURL)
Expand All @@ -589,15 +598,6 @@ func verifyGenerateManifests(
})
continue
}
// If source is Kustomize add build options
kustomizeSettings, err := settingsMgr.GetKustomizeSettings()
if err != nil {
conditions = append(conditions, argoappv1.ApplicationCondition{
Type: argoappv1.ApplicationConditionInvalidSpecError,
Message: fmt.Sprintf("Error getting Kustomize settings: %v", err),
})
continue
}
kustomizeOptions, err := kustomizeSettings.GetOptions(source)
if err != nil {
conditions = append(conditions, argoappv1.ApplicationCondition{
Expand Down

0 comments on commit 6fb63a6

Please sign in to comment.