diff --git a/VERSION b/VERSION index 30404fe992bda..d3c1d0e3b22ca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.8.1-cap-CR-app-version \ No newline at end of file +2.8.1-cap-CR-app-version3 \ No newline at end of file diff --git a/pkg/version_config_manager/version_config_manager.go b/pkg/version_config_manager/version_config_manager.go index c4be2e79ca946..46ba14d83a0fe 100644 --- a/pkg/version_config_manager/version_config_manager.go +++ b/pkg/version_config_manager/version_config_manager.go @@ -2,6 +2,7 @@ package version_config_manager import ( "errors" + log "github.com/sirupsen/logrus" ) @@ -78,7 +79,7 @@ func GetVersionConfig() *VersionConfig { versionConfig, err := versionConfigManager.ObtainConfig() if err != nil { - log.Printf("ERROR: Failed to obtain config: %v", err) + log.Printf("Failed to obtain config: %v", err) return nil } diff --git a/server/application/application_event_reporter.go b/server/application/application_event_reporter.go index 9019238bbf07e..e53b3c1482801 100644 --- a/server/application/application_event_reporter.go +++ b/server/application/application_event_reporter.go @@ -177,7 +177,7 @@ func (s *applicationEventReporter) streamApplicationEvents( return nil } - logWithAppStatus(a, logCtx, ts).Info("sending root application event") + logWithAppStatus(a, logCtx, ts).Infof("sending root application event %v", appEvent) if err := stream.Send(appEvent); err != nil { return fmt.Errorf("failed to send event for root application %s/%s: %w", a.Namespace, a.Name, err) } @@ -305,7 +305,7 @@ func (s *applicationEventReporter) processResource( appRes := appv1.Application{} if isApp(rs) && actualState.Manifest != nil && json.Unmarshal([]byte(*actualState.Manifest), &appRes) == nil { - logWithAppStatus(&appRes, logCtx, ts).Info("streaming resource event") + logWithAppStatus(&appRes, logCtx, ts).Infof("streaming resource event %v", ev) } else { logWithResourceStatus(logCtx, rs).Info("streaming resource event") } @@ -613,6 +613,18 @@ func getResourceEventPayload( AppVersions: applicationVersionsEvents, } + logCtx.Infof("AppVersion before encoding: %v", safeString(payload.AppVersions.AppVersion)) + if payload.AppVersions.Dependencies == nil { + logCtx.Infof("AppVersion deps before encoding. Dependencies == nil") + } else { + logCtx.Infof( + "AppVersion deps before encoding: %v ||| %v ||| %v", + safeString(payload.AppVersions.Dependencies.Lock), + safeString(payload.AppVersions.Dependencies.Deps), + safeString(payload.AppVersions.Dependencies.Requirements), + ) + } + payloadBytes, err := json.Marshal(&payload) if err != nil { return nil, fmt.Errorf("failed to marshal payload for resource %s/%s: %w", rs.Namespace, rs.Name, err) @@ -720,6 +732,18 @@ func (s *applicationEventReporter) getApplicationEventPayload( AppVersions: applicationVersionsEvents, } + logCtx.Infof("AppVersion before encoding: %v", safeString(payload.AppVersions.AppVersion)) + if payload.AppVersions.Dependencies == nil { + logCtx.Infof("AppVersion deps before encoding. Dependencies == nil") + } else { + logCtx.Infof( + "AppVersion deps before encoding: %v ||| %v ||| %v", + safeString(payload.AppVersions.Dependencies.Lock), + safeString(payload.AppVersions.Dependencies.Deps), + safeString(payload.AppVersions.Dependencies.Requirements), + ) + } + payloadBytes, err := json.Marshal(&payload) if err != nil { return nil, fmt.Errorf("failed to marshal payload for resource %s/%s: %w", a.Namespace, a.Name, err) @@ -799,3 +823,10 @@ func repoAppVersionsToEvent(applicationVersions *apiclient.ApplicationVersions) } return applicationVersionsEvents, nil } + +func safeString(s *string) string { + if s == nil { + return "" + } + return *s +} diff --git a/server/application/application_event_reporter_test.go b/server/application/application_event_reporter_test.go index 6ca65058062a9..a60679cb22a40 100644 --- a/server/application/application_event_reporter_test.go +++ b/server/application/application_event_reporter_test.go @@ -60,7 +60,7 @@ func TestGetResourceEventPayload(t *testing.T) { Message: "some message", } - event, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, &revisionMetadata, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, nil) + event, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, &revisionMetadata, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, &apiclient.ApplicationVersions{}) assert.NoError(t, err) var eventPayload events.EventPayload @@ -96,7 +96,7 @@ func TestGetResourceEventPayload(t *testing.T) { Message: "some message", } - event, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, &revisionMetadata, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, nil) + event, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, &revisionMetadata, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, &apiclient.ApplicationVersions{}) assert.NoError(t, err) var eventPayload events.EventPayload @@ -375,7 +375,7 @@ func TestGetResourceEventPayloadWithoutRevision(t *testing.T) { } appTree := v1alpha1.ApplicationTree{} - _, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, nil, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, nil) + _, err := getResourceEventPayload(&app, &rs, &es, &actualState, &desiredState, &appTree, true, "", nil, nil, nil, common.LabelKeyAppInstance, argo.TrackingMethodLabel, &apiclient.ApplicationVersions{}) assert.NoError(t, err) }