New packages cleanup policy rule based on last_downloaded_at
🔥 Problem
Cleanup policies for packages allow users to configure packages / package assets deletion in an automated way.
They do so using available rules.
With Add a `last_downloaded_at` field to the Package... (#362259 - closed) work, a new rule can be implemented:
- Remove packages that have not been downloaded in the last X months.
🚒 Solution
- (MR1) Implement this new parameter in the cleanup policy object.
- Use an explicit name that gives a clear indication of the units used. Example:
keep_packages_downloaded_in_the_last_n_days
.
- Use an explicit name that gives a clear indication of the units used. Example:
- (MR1) The possible values for
X
should be:nil
1 week
1 month
3 months
6 months
12 months
- (MR2) Update the executor (background job) so that this rule is evaluated (if necessary) and marks the target packages as
pending_destruction
. - (MR3 or with MR1) Update the GraphQL endpoint to support the new rule.
-
⚠ In the documentation updates, leave a note that this field (last_downloaded_at
) is not updated when packages are pulled from geo secondaries only. As such, execution of this rule on the geo primary can lead to unwanted situations (for example, if packages are only pulled through geo secondaries). See #405297 (closed).
Edited by David Fernandez