From 0a922155407e334f4ed297f273247e98544b2397 Mon Sep 17 00:00:00 2001 From: Oded Ben Ozer Date: Fri, 17 May 2024 11:10:02 +0200 Subject: [PATCH] Improve error logging --- internal/pkg/argocd/argocd.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/pkg/argocd/argocd.go b/internal/pkg/argocd/argocd.go index b45c9207..e7980cc2 100644 --- a/internal/pkg/argocd/argocd.go +++ b/internal/pkg/argocd/argocd.go @@ -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 }