Skip to content

Commit

Permalink
separate error and nil conditions for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jared-logan-patrick-ct committed Oct 9, 2024
1 parent 1a5819d commit 9874680
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,12 @@ func SetArgoCDAppRevision(ctx context.Context, componentPath string, revision st
return fmt.Errorf("Error creating ArgoCD clients: %w", err)
}
foundApp, err = findArgocdApp(ctx, componentPath, repo, ac.app, useSHALabelForArgoDicovery)
if foundApp == nil || err != nil {
if err != nil {
return fmt.Errorf("error finding ArgoCD application for component path %s: %w", componentPath, err)
}
if foundApp == nil {
return fmt.Errorf("no ArgoCD application was found for component path: %s", componentPath)
}
if foundApp.Spec.Source.TargetRevision == revision {
log.Infof("App %s already has revision %s", foundApp.Name, revision)
return nil
Expand Down

0 comments on commit 9874680

Please sign in to comment.