Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: revisions info reporting with multi-sourced apps support #333

Open
wants to merge 24 commits into
base: release-2.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9ecb8eb
event-reporter: added utils methods to retrieve revisions metadata fo…
oleksandr-codefresh Sep 10, 2024
37f5a05
event-reporter: report all revisions metadata instead single to suppo…
oleksandr-codefresh Sep 11, 2024
bf0e87a
event-reporter: added revision sha to reported value in anotations - …
oleksandr-codefresh Sep 25, 2024
e757883
Merge branch 'release-2.12' of github.com:codefresh-io/argo-cd into C…
oleksandr-codefresh Sep 25, 2024
1ad1112
event-reporter: added change revisions sha to reported value in anota…
oleksandr-codefresh Sep 25, 2024
3dd3f0d
event-reporter: updated changelog
oleksandr-codefresh Sep 25, 2024
54258ef
event-reporter: changes to anotations repoting - app.meta.revisions-m…
oleksandr-codefresh Sep 27, 2024
a9c0b2c
event-reporter: changes after pr review
oleksandr-codefresh Sep 27, 2024
7e1f1c2
Merge branch 'release-2.12' of github.com:codefresh-io/argo-cd into C…
oleksandr-codefresh Sep 27, 2024
472aa63
event-reporter: fixed unit tests
oleksandr-codefresh Sep 27, 2024
9bc3265
event-reporter: fix lint issues
oleksandr-codefresh Sep 27, 2024
c3becdc
Merge branch 'release-2.12' of github.com:codefresh-io/argo-cd into C…
pasha-codefresh Sep 30, 2024
d3ccc7d
Merge branch 'CR-23842-revisions-info-reporting' of github.com:codefr…
pasha-codefresh Sep 30, 2024
006f6db
event-reporter: changes after pr reviev, fixing typo, added dedicated…
oleksandr-codefresh Sep 30, 2024
c6d1667
Merge branch 'CR-23842-revisions-info-reporting' of github.com:codefr…
oleksandr-codefresh Sep 30, 2024
fb704ae
event-reporter: refactoring of getApplicationLegacyRevisionDetails me…
oleksandr-codefresh Sep 30, 2024
91272b6
event-reporter / app_revision_test.go: added some tests to AddCommits…
oleksandr-codefresh Sep 30, 2024
a8cc45e
event-reporter / app_revision_test.go: added tests for GetRevisionsDe…
oleksandr-codefresh Oct 1, 2024
02c14a3
event-reporter: updated app client to support sourceIndex param in no…
oleksandr-codefresh Oct 1, 2024
09fddac
event-reporter / app_revision.go: added sourceIndex param to applicat…
oleksandr-codefresh Oct 1, 2024
ea8cdce
Merge branch 'release-2.12' of github.com:codefresh-io/argo-cd into C…
oleksandr-codefresh Oct 1, 2024
29db9f8
event-reporter: lint fix
oleksandr-codefresh Oct 1, 2024
b395e00
event-reporter: fix lint issues
oleksandr-codefresh Oct 1, 2024
d5c22f3
event-reporter: fix lint issues
oleksandr-codefresh Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
event-reporter: fix lint issues
  • Loading branch information
oleksandr-codefresh committed Sep 27, 2024
commit 9bc3265d09b62360da55ab84bd45e295f658180c
4 changes: 2 additions & 2 deletions event_reporter/reporter/app_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ 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"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -60,7 +62,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 +71,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

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
Loading