Container repository cleanup API
What does this MR do?
This adds Container Registry manipulation API.
The most important part of this API is Tags cleaner. Tags cleaner offers a bunch of options to remove obsolete tags from the system:
- The Tags Cleaner never touches
:latest
, - The Tags Cleaner only removes blobs matching
name_regex
, - The
name_regex
is a required parameter and has to be provided by the project owner, - If you want to match all tags you need to specify
.*
forname_regex
, - You can always unconditionally keep n-latest images with
keep-n
, - You can specify
older_than
only tags older than giventimespec
will be removed, - The API schedules asynchronous job,
- The job can be run no more than once per-hour (as this is a very expensive operation to walk all revisions),
Look at app/services/projects/container_repository/cleanup_tags_service.rb
to understand the ordering of the operations
as defined above.
Notice
Tags cleaner does not remove actual blobs.
The blobs need to be removed separately using registry garbage-collect
or docker-distribution-pruner
.
What are the relevant issue numbers?
Resolves https://gitlab.com/gitlab-org/gitlab-ce/issues/55978
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer
Edited by Ash McKenzie