Record latest container registry cleanup policy execution timestamp and exit status
Problem to solve
Currently, we don't record the execution timestamp and the status (success/error) of the container registry cleanup policies.
For the upcoming gradual migration/upgrade of the GitLab.com registry (container-registry#191 (closed)), ideally, we'll migrate existing repositories as they become clean from unnecessary tags. This cleanup will be carried on by the cleanup policies. However, without the timestamp and the success/error status of the last cleanup policy execution, we have no programmatic way to tell whether a given repository has been successfully cleaned or not.
Having the execution timestamp and status of the last cleanup policy run will also be useful for general debug purposes.
Proposal
Use the Packages::Event
model to capture the timestamp of when a cleanup policy is started, completed, stopped or unfinished.
Introduce 3 events for the Packages::Event
model for cleanup status: (These attributes should be updated every time a cleanup policy is executed.)
- cleanup started
- cleanup done
- cleanup stopped or unfinished
For the container registry, is thus than a matter of select container repositories that have an event like cleanup done
associated with them.