Skip to content

Commit 56d46f2

Browse files
Merge branch 'release-2.12' of github.com:codefresh-io/argo-cd into CR-23668-multisource-details-reporting
# Conflicts: # event_reporter/reporter/application_event_reporter.go # event_reporter/reporter/event_payload.go # event_reporter/reporter/types.go
2 parents 86c7b0e + 5af7ecc commit 56d46f2

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

event_reporter/reporter/application_event_reporter.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,10 @@ func (s *applicationEventReporter) StreamApplicationEvents(
251251

252252
// returns appVersion from first non-ref source for multisourced apps
253253
func (s *applicationEventReporter) resolveApplicationVersions(ctx context.Context, a *appv1.Application, logCtx *log.Entry) *apiclient.ApplicationVersions {
254-
var applicationVersions *apiclient.ApplicationVersions
255-
256254
if a.Spec.HasMultipleSources() {
257255
syncResultRevisions := utils.GetOperationSyncResultRevisions(a)
258256
if syncResultRevisions == nil {
259-
return applicationVersions
257+
return nil
260258
}
261259

262260
var sourcePositions []int64
@@ -270,12 +268,12 @@ func (s *applicationEventReporter) resolveApplicationVersions(ctx context.Contex
270268

271269
syncResultRevision := utils.GetOperationSyncResultRevision(a)
272270

273-
if syncResultRevision != nil {
274-
syncManifests, _ := s.getDesiredManifests(ctx, logCtx, a, syncResultRevision, nil, nil)
275-
return syncManifests.GetApplicationVersions()
271+
if syncResultRevision == nil {
272+
return nil
276273
}
277274

278-
return applicationVersions
275+
syncManifests, _ := s.getDesiredManifests(ctx, logCtx, a, syncResultRevision, nil, nil)
276+
return syncManifests.GetApplicationVersions()
279277
}
280278

281279
func (s *applicationEventReporter) getAppForResourceReporting(

event_reporter/reporter/event_payload.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,8 @@ func buildEventObjectAsLiveAndCompiledManifestsEmpty(
208208
) ([]byte, error) {
209209
// no actual or desired state, don't send event
210210
u := &unstructured.Unstructured{}
211-
apiVersion := rr.rs.Version
212-
if rr.rs.Group != "" {
213-
apiVersion = rr.rs.Group + "/" + rr.rs.Version
214-
}
215211

216-
u.SetAPIVersion(apiVersion)
212+
u.SetAPIVersion(rr.GetApiVersion())
217213
u.SetKind(rr.rs.Kind)
218214
u.SetName(rr.rs.Name)
219215
u.SetNamespace(rr.rs.Namespace)

event_reporter/reporter/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ type ArgoTrackingMetadata struct {
3232
AppInstanceLabelKey *string
3333
TrackingMethod *appv1.TrackingMethod
3434
}
35+
36+
func (rr *ReportedResource) GetApiVersion() string {
37+
apiVersion := rr.rs.Version
38+
if rr.rs.Group != "" {
39+
apiVersion = rr.rs.Group + "/" + rr.rs.Version
40+
}
41+
42+
return apiVersion
43+
}

0 commit comments

Comments
 (0)