Sign inSign up

ovalmoney/gitlab-registry-cleaner

By ovalmoney

•Updated about 6 years ago

Clean Gitlab Registry

Image
0

50K+

ovalmoney/gitlab-registry-cleaner repository overview

⁠Gitlab Registry Cleaner

This tool helps interaction with Gitlab Registry Delete API to keep a clean registry.

Is already made to be run inside a Gitlab CI job so it will try to take all base config from Gitlab CI ENV vars

⁠Setup

⁠Local
⁠Requirements
  • poetry
  • pyenv
  • python >= 3.7
⁠Install
  • pyenv install 3.7.0
  • pyenv virtualenv 3.7.0 gitlab-registry-cleaner
  • pyenv local gitlab-registry-cleaner
  • poetry install
⁠Docker
⁠Requirements
  • docker
⁠Build

docker build -t ovalmoney/gitlab-registry-cleaner:latest .

⁠Run

docker run -it --rm ovalmoney/gitlab-registry-cleaner:latest

⁠Usage

To see a complete list of options gitlab-registry-cleaner --help

Gitlab Registry Cleaner accepts command options or ENV vars

⁠Options
optionenv vartyperequireddefaultdesc
--api-urlTEXTGRC_API_V4_URL, CI_API_V4_URL*Gitlab API Url (e.g. https://example.com:3000/api/v4⁠)
--tokenTEXTGRC_TOKEN, CI_JOB_TOKEN*Gitlab API Token
--project-idINTGRC_PROJECT_ID, CI_PROJECT_ID*Gitlab Project ID
--repository-nameREGEXGRC_REPOSITORY_NAME.*Gitlab Registry Repository Name
--tag-nameREGEXGRC_TAG_NAME.*Tag names to delete
--keep-nINTGRC_KEEP_N0Keep last N tags
--older-thanTEXTGRC_OLDER_THANDelete tags older than (e.g. 1h)
--dry-runBOOLFalseLog what would do without doing it

Tag summary

Content type

Image

Digest

Size

30 MB

Last updated

about 6 years ago

docker pull ovalmoney/gitlab-registry-cleaner