Skip to content

Commit

Permalink
[ event-reporter / getDesiredManifests ]: report only live state in c…
Browse files Browse the repository at this point in the history
…ase of error
  • Loading branch information
oleksandr-codefresh committed Jan 15, 2024
1 parent e8ec3af commit 615d9a6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
14 changes: 0 additions & 14 deletions event_reporter/reporter/application_event_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions server/application/application_event_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 615d9a6

Please sign in to comment.