Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devs-group/gitlab-registry-cleaner

Tiny container which can be used to remove images from gitlab registry.
https://github.com/devs-group/gitlab-registry-cleaner

Last synced: about 1 month ago
JSON representation

Tiny container which can be used to remove images from gitlab registry.

Awesome Lists containing this project

README

        

# Gitlab Registry Cleaner

Gitlab Registry Cleaner is a tiny container which can be used to remove images from gitlab registry.

## Usage

1. Create gitlab access token. Read how to [here](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token).

1. Run container in your `.gitlab-ci.yml`
```sh
docker run \
&& -e ACCESS_TOKEN='' \
&& -e PROJECT_ID=$CI_PROJECT_ID \
&& -e IMAGE_TAG=$CI_BUILD_REF_NAME \
&& -e IMAGE_LOCATION=$GITLAB_REGISTRY/$CI_PROJECT_PATH/ \
&& devsgroup/gitlab-registry-cleaner:latest
```

E.g.
```yml
delete_frontend_image:
stage: clean
script:
- |
docker run \
-e ACCESS_TOKEN=$GITLAB_ACCESS_TOKEN \
-e PROJECT_ID=$CI_PROJECT_ID \
-e IMAGE_TAG=$CI_BUILD_REF_NAME \
-e IMAGE_LOCATION=$GITLAB_REGISTRY/$CI_PROJECT_PATH/web_frontend \
devsgroup/gitlab-registry-cleaner:latest
only:
- branches
except:
- master
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)