Skip to content

GitLab Next

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

Closed
Open
Opened Nov 11, 2020 by Mitar@mitarContributor

Cleanup policy for tags to support dynamic names

Release notes

If you are using CI to build and publish container images, chances are you are naming them dynamically. For example, using GitLab's pre-defined environment variables you could have two different images: mitar/example/branch/<branch name>:latest and mitar/example/pipeline/<pipeline id>:latest.

The problem is that GitLab's cleanup policies only allow you to remove images based on tag name and has not supported dynamic names. This has forced many of you to manually remove these images using the container registry API or not removing them and spending more on storage costs.

Not anymore. Moving forward when managing your project's policies you can choose whether you want your regex applied to the tag name or the full path. If you are interested in contributing and helping to improve this product, documentation and examples are great ways to help. (because who is good at regex?)

Problem to solve

The cleanup policies for tags do not support dynamic container image names. This is problematic for users that use GitLab's pre-defined environment variables to dynamically name their branch and pipeline specific container images. The impact of this problem is that you are paying more for storage or it's just harder to find your container images in the UI.

Proposal

Support dynamic image names by allowing the user to select if the regex inputted should match based on tag name only or the full path. This will work with both the API and the user interface. The default state of the checkbox (or other UI moment) will be set to only the tag name so that all the regex already implemented will continue to work and we offer a new ability that users can turn on if they want to include the path.

Documentation

  • Update the documentation to make it clear that the current policy only works on tag name
  • regex examples are like v.+. I think they should be ^v.+ and for master they should be ^master$

Metrics

Measure the number of policies using tag name only vs. the full path.

Edited Dec 02, 2020 by Tim Rizzi
Assignee
Assign to
Backlog
Milestone
Backlog
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab#281071