Skip to content

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:

  1. The Tags Cleaner never touches :latest,
  2. The Tags Cleaner only removes blobs matching name_regex,
  3. The name_regex is a required parameter and has to be provided by the project owner,
  4. If you want to match all tags you need to specify .* for name_regex,
  5. You can always unconditionally keep n-latest images with keep-n,
  6. You can specify older_than only tags older than given timespec will be removed,
  7. The API schedules asynchronous job,
  8. 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?

Edited by Ash McKenzie

Merge request reports

Loading