Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab FOSS
GitLab FOSS
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Issues
  • #55978

Closed
Open
Opened Jan 06, 2019 by Kamil Trzciński@ayufanMaintainer

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:

    1. GET /projects/:id/registry/repositories - list all container repositories in GitLab,
    1. GET /projects/:id/registry/repository/:path - get details about single repository in GitLab,
    1. GET /projects/:id/registry/repository/:path/tags - get all tags in the repository in GitLab,
    1. GET /projects/:id/registry/repository/:path/tag/:tag_name - get details about tag in the repository in GitLab,
    1. DELETE /projects/:id/registry/repository/:path/tag/:tag_name - delete tag from GitLab,
    1. DELETE /projects/:id/registry/repository/:path/tags - schedule a deletion of tags matching given conditions,
    1. DELETE /projects/:id/registry/repository/:path - delete given repository.

I plan to implement:

    1. GET /projects/:id/registry/repositories - list all container repositories in GitLab,
    1. GET /projects/:id/registry/repository/:path - get details about single repository in GitLab,
    1. GET /projects/:id/registry/repository/:path/tags - get all tags in the repository in GitLab,
    1. DELETE /projects/:id/registry/repository/:path/tags - schedule a deletion of tags matching given conditions,

The most interesting is:

    1. 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: an regexp 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

Edited Jan 10, 2019 by Kamil Trzciński
Assignee
Assign to
11.8
Milestone
11.8 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab-foss#55978