diff --git a/event_reporter/reporter/app_revision.go b/event_reporter/reporter/app_revision.go index a9f66ab60ab872..ad1b40a3c9c5ee 100644 --- a/event_reporter/reporter/app_revision.go +++ b/event_reporter/reporter/app_revision.go @@ -2,6 +2,7 @@ package reporter import ( "context" + "github.com/argoproj/argo-cd/v2/event_reporter/utils" "github.com/argoproj/argo-cd/v2/pkg/apiclient/application" appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" @@ -60,7 +61,6 @@ func (s *applicationEventReporter) getApplicationRevisionsMetadata(ctx context.C if a.Status.Sync.Revision != "" || a.Status.Sync.Revisions != nil || (a.Status.History != nil && len(a.Status.History) > 0) { // can be the latest revision of repository operationSyncRevisionsMetadata, err := s.getRevisionsDetails(ctx, a, utils.GetOperationSyncRevisions(a)) - if err != nil { logCtx.WithError(err).Warnf("failed to get application(%s) sync revisions metadata, resuming", a.GetName()) } @@ -70,7 +70,6 @@ func (s *applicationEventReporter) getApplicationRevisionsMetadata(ctx context.C } // latest revision of repository where changes to app resource were actually made; empty if no changeRevisionŃ– present operationChangeRevisionsMetadata, err := s.getRevisionsDetails(ctx, a, utils.GetOperationChangeRevisions(a)) - if err != nil { logCtx.WithError(err).Warnf("failed to get application(%s) change revisions metadata, resuming", a.GetName()) } diff --git a/event_reporter/reporter/event_payload.go b/event_reporter/reporter/event_payload.go index 5097fe8b227234..cbac9a9031d328 100644 --- a/event_reporter/reporter/event_payload.go +++ b/event_reporter/reporter/event_payload.go @@ -239,7 +239,6 @@ func (s *applicationEventReporter) getApplicationEventPayload( } revisionsMetadata, err := s.getApplicationRevisionsMetadata(ctx, logCtx, a) - if err != nil { if !strings.Contains(err.Error(), "not found") { return nil, fmt.Errorf("failed to get revision metadata: %w", err) diff --git a/event_reporter/reporter/event_payload_test.go b/event_reporter/reporter/event_payload_test.go index 8e60befdcfeb82..dc305a099c897b 100644 --- a/event_reporter/reporter/event_payload_test.go +++ b/event_reporter/reporter/event_payload_test.go @@ -2,9 +2,10 @@ package reporter import ( "encoding/json" - "github.com/argoproj/argo-cd/v2/event_reporter/utils" "testing" + "github.com/argoproj/argo-cd/v2/event_reporter/utils" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -38,7 +39,7 @@ func TestGetResourceEventPayload(t *testing.T) { } appTree := v1alpha1.ApplicationTree{} revisionMetadata := utils.AppSyncRevisionsMetadata{ - SyncRevisions: []*utils.RevisionWithMetadata{&utils.RevisionWithMetadata{ + SyncRevisions: []*utils.RevisionWithMetadata{{ Metadata: &v1alpha1.RevisionMetadata{ Author: "demo usert", Date: metav1.Time{}, diff --git a/event_reporter/utils/app_revision.go b/event_reporter/utils/app_revision.go index ba770a648b15f5..49c26d8657992a 100644 --- a/event_reporter/utils/app_revision.go +++ b/event_reporter/utils/app_revision.go @@ -155,7 +155,6 @@ func AddCommitsDetailsToAnnotations(unstrApp *unstructured.Unstructured, revisio } jsonRevisionsMetadata, err := json.Marshal(revisionsMetadata) - if err != nil { return unstrApp } @@ -175,7 +174,6 @@ func AddCommitsDetailsToAppAnnotations(app appv1.Application, revisionsMetadata } jsonRevisionsMetadata, err := json.Marshal(revisionsMetadata) - if err != nil { return app }