From 207f20c916dbe0bc0b1e2080273aea2a6a796fd0 Mon Sep 17 00:00:00 2001 From: Oleksandr Saulyak Date: Tue, 16 Jan 2024 12:15:36 +0200 Subject: [PATCH] fix:CR-22128-manifest-gen-error (#273) * [ event-reporter / getDesiredManifests ]: report only live state in case of error * added CHANGELOG.md --- changelog/CHANGELOG.md | 7 +++++++ .../reporter/application_event_reporter.go | 14 -------------- server/application/application_event_reporter.go | 12 ------------ 3 files changed, 7 insertions(+), 26 deletions(-) create mode 100644 changelog/CHANGELOG.md diff --git a/changelog/CHANGELOG.md b/changelog/CHANGELOG.md new file mode 100644 index 0000000000000..071d854e9df08 --- /dev/null +++ b/changelog/CHANGELOG.md @@ -0,0 +1,7 @@ +### Event reporter v2.0.2 + +* Fix: app events with manifest generation error (non-existed path, repo, project, etc.) not reported to codefresh + +### Argocd Server (built-in event-reporter) + +* Fix: app events with manifest generation error (non-existed path, repo, project, etc.) not reported to codefresh \ No newline at end of file diff --git a/event_reporter/reporter/application_event_reporter.go b/event_reporter/reporter/application_event_reporter.go index 01a647a9caf8b..3dfd8df48f9fd 100644 --- a/event_reporter/reporter/application_event_reporter.go +++ b/event_reporter/reporter/application_event_reporter.go @@ -124,20 +124,6 @@ func (r *applicationEventReporter) getDesiredManifests(ctx context.Context, a *a Revision: &a.Status.Sync.Revision, }) if err != nil { - notManifestGenerationError := !strings.Contains(err.Error(), "Manifest generation error") - - // we can ignore the error - notAppPathDoesntExistsError := !strings.Contains(err.Error(), "app path does not exist") - - wrongDestinationError := !strings.Contains(err.Error(), "error validating destination") - - // when application deleted rbac also throws erorr with PermissionDenied - // we can ignore the error, as we check rbac access before reporting events - notPermissionDeniedError := !strings.Contains(err.Error(), "PermissionDenied") - - if notManifestGenerationError && notPermissionDeniedError && notAppPathDoesntExistsError && wrongDestinationError { - return nil, fmt.Errorf("failed to get application desired state manifests: %w", err), false - } // if it's manifest generation error we need to still report the actual state // of the resources, but since we can't get the desired state, we will report // each resource with empty desired state diff --git a/server/application/application_event_reporter.go b/server/application/application_event_reporter.go index fc0a918a328e8..2786b0c4b9478 100644 --- a/server/application/application_event_reporter.go +++ b/server/application/application_event_reporter.go @@ -88,18 +88,6 @@ func (s *applicationEventReporter) getDesiredManifests(ctx context.Context, a *a Revision: &a.Status.Sync.Revision, }) if err != nil { - notManifestGenerationError := !strings.Contains(err.Error(), "Manifest generation error") - - // we can ignore the error - notAppPathDoesntExistsError := !strings.Contains(err.Error(), "app path does not exist") - - // when application deleted rbac also throws erorr with PermissionDenied - // we can ignore the error, as we check rbac access before reporting events - notPermissionDeniedError := !strings.Contains(err.Error(), "PermissionDenied") - - if notManifestGenerationError && notPermissionDeniedError && notAppPathDoesntExistsError { - return nil, fmt.Errorf("failed to get application desired state manifests: %w", err), false - } // if it's manifest generation error we need to still report the actual state // of the resources, but since we can't get the desired state, we will report // each resource with empty desired state