Allow to remove unused tags from Container Registry
Problem to solve
Currently, a number of tags grow over time. Must of the uses of Container Registry use Registry for building intermediate images. We should allow to define retention policies for different types of images, and allow user an ability to define for how long persist the image, what are allowed names of tags, etc.
This tied with garbage collection
of images will let users to manage their's registry.
Target audience
Mostly DevOps Engineer
, and Systems Administrator
.
Proposal
Add a set of APIs:
-
-
GET /projects/:id/registry/repositories
- list all container repositories in GitLab,
-
-
-
GET /projects/:id/registry/repository/:path
- get details about single repository in GitLab,
-
-
-
GET /projects/:id/registry/repository/:path/tags
- get all tags in the repository in GitLab,
-
-
-
GET /projects/:id/registry/repository/:path/tag/:tag_name
- get details about tag in the repository in GitLab,
-
-
-
DELETE /projects/:id/registry/repository/:path/tag/:tag_name
- delete tag from GitLab,
-
-
-
DELETE /projects/:id/registry/repository/:path/tags
- schedule a deletion of tags matching given conditions,
-
-
-
DELETE /projects/:id/registry/repository/:path
- delete given repository.
-
I plan to implement:
-
-
GET /projects/:id/registry/repositories
- list all container repositories in GitLab,
-
-
-
GET /projects/:id/registry/repository/:path
- get details about single repository in GitLab,
-
-
-
GET /projects/:id/registry/repository/:path/tags
- get all tags in the repository in GitLab,
-
-
-
DELETE /projects/:id/registry/repository/:path/tags
- schedule a deletion of tags matching given conditions,
-
The most interesting is:
-
-
DELETE /projects/:id/registry/repository/:path/tags
- schedule a deletion of tags matching given conditions,
-
I plan to give the following arguments for the purpose of filtering:
-
tag_name
: anregexp
of allowed tag names, tags not matching that name will be removed,latest
will not be removed, -
older_than
: tags older than will be removed from the system, -
all
: delete all tags (set explicitly to prevent from doing mistakes)
Notice
Important, the API will only unlink tags
. It will not remove actual blobs
yet.
The blobs needs to be removed separately via registry garbage-collect
(ideally with -m
)
or docker-distribution-pruner
.
Links / references
Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/25322