From 615d9a65f7848f48ed7205821cca1b947c06c230 Mon Sep 17 00:00:00 2001 From: oleksandr-codefresh Date: Mon, 15 Jan 2024 15:49:18 +0200 Subject: [PATCH] [ event-reporter / getDesiredManifests ]: report only live state in case of error --- .../reporter/application_event_reporter.go | 14 -------------- server/application/application_event_reporter.go | 12 ------------ 2 files changed, 26 deletions(-) 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