Skip to content

Commit

Permalink
fix:CR-22128-manifest-gen-error (#273)
Browse files Browse the repository at this point in the history
* [ event-reporter / getDesiredManifests ]: report only live state in case of error

* added CHANGELOG.md
  • Loading branch information
oleksandr-codefresh authored Jan 16, 2024
1 parent e8ec3af commit 207f20c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
7 changes: 7 additions & 0 deletions changelog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
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 207f20c

Please sign in to comment.