feat(cleanup): clean failed gitjobs after a retention period - #5447
Open
susesamu wants to merge 2 commits into
Open
feat(cleanup): clean failed gitjobs after a retention period#5447susesamu wants to merge 2 commits into
susesamu wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an optional retention period to the Fleet cleanup CLI so failed GitRepo Jobs (and their Pods via background propagation) can be automatically deleted once they’re older than a configured threshold, while preserving the current default behavior (failed jobs kept indefinitely).
Changes:
- Extend
cleanup gitjobto accept a--retentionduration for failed jobs and pass it through to cleanup logic. - Update job cleanup logic to delete failed GitRepo-owned Jobs only when
retention > 0and the job’sCompletionTimeis older than the threshold. - Add integration test coverage for retention behavior (delete old failed jobs, keep recent failed jobs, and preserve default behavior when retention is unset/zero).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/cmd/cli/cleanup/cleanup.go | Adds retention-aware deletion rules for failed GitRepo Jobs while keeping immediate deletion for succeeded Jobs. |
| internal/cmd/cli/cleanup.go | Introduces --retention CLI flag, parses the duration, and wires it into the cleanup execution path. |
| integrationtests/cli/cleanup/cleanup_jobs_test.go | Adds integration tests validating retention-based cleanup semantics for failed jobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+168
to
+171
| retention, err = time.ParseDuration(r.Retention) | ||
| if err != nil { | ||
| return fmt.Errorf("invalid retention duration: %w", err) | ||
| } |
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
susesamu
force-pushed
the
5440-retention-period
branch
from
July 15, 2026 15:25
b701561 to
64714e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refers to #5440