Skip to content

Commit

Permalink
event-reporter: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-codefresh committed Sep 27, 2024
1 parent 472aa63 commit 893fbcd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions event_reporter/reporter/app_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
}
Expand All @@ -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())
}
Expand Down
1 change: 0 additions & 1 deletion event_reporter/reporter/event_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions event_reporter/reporter/event_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{},
Expand Down
2 changes: 0 additions & 2 deletions event_reporter/utils/app_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ func AddCommitsDetailsToAnnotations(unstrApp *unstructured.Unstructured, revisio
}

jsonRevisionsMetadata, err := json.Marshal(revisionsMetadata)

if err != nil {
return unstrApp
}
Expand All @@ -175,7 +174,6 @@ func AddCommitsDetailsToAppAnnotations(app appv1.Application, revisionsMetadata
}

jsonRevisionsMetadata, err := json.Marshal(revisionsMetadata)

if err != nil {
return app
}
Expand Down

0 comments on commit 893fbcd

Please sign in to comment.