Problem to solve
removing container registry images (in bulk) using gitlab api without personal access token.
container registry images tags for refrence:
- v1.3.0
- v1.2.0
- v1.2.2
- v1.1.0
- v1.0.0
- latest
- temp-commitsha
the cleanup policy in the gitlab ui is used for cleaning non-version images daily and only keeping the versions. (tags that aren’t vx.x.x are removed except for latest and vx.x.x tags)
what I am trying to achive is removing version tags after a specific action via pipeline or scheduled, however the only avalaible api to remove image’s tags in bulks only accepts personal access tokens with full api scope (some security risks).
is there another way of achiving this?
what I have tried
created a token (container_registry:<registory_path>:delete) following the Obtain token from gitlab approach
then used the created token as shown in its steps but in the Delete registry repository tags in bulk api
it is always giving me Unauthorized message
Versions
- Self-managed
-
GitLab.com
SaaS - Dedicated
Versions
- GitLab v17.4