Skip to content

Commit

Permalink
Improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Oded-B committed May 17, 2024
1 parent 7f33a8b commit 0a92215
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,34 +238,41 @@ func GenerateDiffOfChangedComponents(ctx context.Context, componentPathList []st
// env var should be centralized
client, err := createArgoCdClient()
if err != nil {
log.Errorf("Error creating ArgoCD client: %v", err)
return false, true, nil, err
}

conn, appIf, err := client.NewApplicationClient()
if err != nil {
log.Errorf("Error creating ArgoCD app client: %v", err)
return false, true, nil, err
}
defer argoio.Close(conn)

conn, projIf, err := client.NewProjectClient()
if err != nil {
log.Errorf("Error creating ArgoCD project client: %v", err)
return false, true, nil, err
}
defer argoio.Close(conn)

conn, settingsIf, err := client.NewSettingsClient()
if err != nil {
log.Errorf("Error creating ArgoCD settings client: %v", err)
return false, true, nil, err
}
defer argoio.Close(conn)
argoSettings, err := settingsIf.Get(ctx, &settings.SettingsQuery{})
if err != nil {
log.Errorf("Error getting ArgoCD settings: %v", err)
return false, true, nil, err
}

log.Debugf("Checking diff for components: %v", componentPathList)
for _, componentPath := range componentPathList {
currentDiffResult := generateDiffOfAComponent(ctx, componentPath, prBranch, repo, appIf, projIf, argoSettings)
if currentDiffResult.DiffError != nil {
log.Errorf("Error generating diff for component %s: %v", componentPath, currentDiffResult.DiffError)
hasComponentDiffErrors = true
err = currentDiffResult.DiffError
}
Expand Down

0 comments on commit 0a92215

Please sign in to comment.