Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cleanup): remove 2nd check on thresholdDays in old pipeline clean…
…up (#2948) * fix(pipeline cleanup): remove 2nd check on thresholdDays Fixes spinnaker/spinnaker#4467 OldPipelineCleanupPollingNotificationAgent is checking the age of the pipeline execution twice before removing it: 1. the `Observable<Execution>` returned from `executionRepository.retrievePipelinesForApplication(app)` is filtered to only executions that have a completed status and where startTime (or buildTime, if startTime is not set) is before `now - thresholdDays days` 2. After converting the `Observable<Execution>` to a `List`, sorting it, and retaining `minimumPipelineExecutions` elements, each execution is only deleted if `days between startTime and now > thresholdDays`. The first check is true for executions as soon as they are a moment older than `executionDays` days, but the second requires executions to be older than `executionDays + 1` days (due to using `>`). Since the second check seems redundant, I've simplify removed it. My assumption here is that it is a bug that a configuration setting like `thresholdDays: N` actually only removes executions older than `N+1` days. * refactor(pipeline cleanup): failing test to demonstrate #4467 Refactor the existing test to demonstrate spinnaker/spinnaker#4467 The existing test logic sets up 7 Executions that are all one day apart (D1, D2, D3, D4, D5, D6, D7), and then sets the clock to be at D10. This masks the bug where only executions older than `thresholdDays + 1` days are deleted, since every execution is older than `thresholdDays + 1` after removing the most recent `minimumPipelineExecutions` from the candidates to be removed.
- Loading branch information