Skip to content

Commit

Permalink
wrap to identify where errors are
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus committed Dec 18, 2023
1 parent 50b535d commit b82fbf1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/argo_client/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/argoproj/argo-cd/v2/reposerver/repository"
"github.com/argoproj/argo-cd/v2/util/git"
"github.com/ghodss/yaml"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -51,22 +52,22 @@ func GetManifestsLocal(ctx context.Context, name string, tempRepoDir string, cha
if err != nil {
telemetry.SetError(span, err, "Argo Get App")
getManifestsFailed.WithLabelValues(name).Inc()
return nil, err
return nil, errors.Wrap(err, "failed to get application")
}
log.Trace().Msgf("Argo App: %+v", app)

cluster, err := clusterIf.Get(ctx, &cluster.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
if err != nil {
telemetry.SetError(span, err, "Argo Get Cluster")
getManifestsFailed.WithLabelValues(name).Inc()
return nil, err
return nil, errors.Wrap(err, "failed to get cluster")
}

argoSettings, err := settingsClient.Get(ctx, &settings.SettingsQuery{})
if err != nil {
telemetry.SetError(span, err, "Argo Get Settings")
getManifestsFailed.WithLabelValues(name).Inc()
return nil, err
return nil, errors.Wrap(err, "failed to get settings")
}

// Code is commented out until Argo fixes the server side manifest generation
Expand Down Expand Up @@ -98,7 +99,7 @@ func GetManifestsLocal(ctx context.Context, name string, tempRepoDir string, cha
}, true, &git.NoopCredsStore{}, resource.MustParse("0"), nil)
if err != nil {
telemetry.SetError(span, err, "Generate Manifests")
return nil, err
return nil, errors.Wrap(err, "failed to generate manifests")
}

if res.Manifests == nil {
Expand Down

0 comments on commit b82fbf1

Please sign in to comment.