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

On https://gitlab.com:

  • 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):

  1. Collects all tags for a given repository in a list.
  2. Excludes the tag named latest from the list.
  3. Evaluates the name_regex (tags to expire), excluding non-matching names from the list.
  4. Excludes any tags that do not have a manifest (not part of the options in the UI).
  5. Orders the remaining tags by created_date.
  6. Excludes from the list the N tags based on the keep_n value (Number of tags to retain).
  7. Excludes from the list the tags more recent than the older_than value (Expiration interval).
  8. Excludes from the list any tags matching the name_regex_keep value (tags to preserve).
  9. Finally, the remaining tags in the list are deleted from the Container Registry.

Relevant logs and/or screenshots

Screenshot_from_2021-03-19_09-50-17

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