Container registry cleanup policy wiped all images
Summary
Container registry cleanup policy wiped all images in two of our repositories.
Steps to reproduce
Example Project
- gooddata/gdc-msf-modeler (private)
- gooddata/gdc-analytical-designer (private)
Note: the cleanup policy is currently disabled to prevent possible data loss.
What is the current bug behavior?
We have 4 repositories with a cleanup policy set. All policies are mostly the same, they slightly differ in periodicity (run daily or weekly)
and in older_than value (30 or 90 days). The regex patterns are the same in all four policies.
The problem is that on two of these four repositories, we have lost all images that were built and stored in the repo's container registry. It happened twice (right after the cleanup), so I don't want to risk further wipeout so I disabled the cleanup policy.
Surprisingly, the other two repositories (gooddata/gdc-dashboards and gooddata/gdc-nas) are NOT affected and images are preserved according cleanup policy parameters.
What is the expected correct behavior?
According to your documentation at least some docker images should remain after cleanup, when the following parameters are given:
keep_n = 10
older_than = 90 days
name_regex_keep = (master|stable.*)
name_regex = .*
Rules (stolen from your documentation):
- Collects all tags for a given repository in a list.
- Excludes the tag named
latestfrom the list. - Evaluates the
name_regex(tags to expire), excluding non-matching names from the list. - Excludes any tags that do not have a manifest (not part of the options in the UI).
- Orders the remaining tags by
created_date. - Excludes from the list the N tags based on the
keep_nvalue (Number of tags to retain). - Excludes from the list the tags more recent than the
older_thanvalue (Expiration interval). - Excludes from the list any tags matching the
name_regex_keepvalue (tags to preserve). - Finally, the remaining tags in the list are deleted from the Container Registry.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
N/A
Results of GitLab application Check
N/A
Possible fixes
N/A
