With every pipeline, I push a docker image to the container registry. That gets picked up by the infrastructure do deploy.
Now after a feature branch is finished, I’d like to automatically delete that image, so I thought I’d do that in the environment stop job.
I just don’t know how to get the repository_id I need for the correct API URL.
In the pipeline, I push each image to $CI_REGISTRY_IMAGE/$APP_NAME-$CI_COMMIT_REF_SLUG:$CI_PIPELINE_ID where APP_NAME is the only one I set myself, but it is set globally so available everywhere.
So for the stop job I have one call actually deconstructing the deployment, and I added another call to delete the now obsolete image:
curl -X DELETE CI_API_V4_URL/projects/$CI_PROJECT_ID/registry/repositories/%find repo id plz%/stuff-$CI_COMMIT_REF_SLUG/tags
Except I somehow need the
So how can I delete the images I pushed during development of this feature? There will be several tags (one per pipeline) for this branch, so I’m deleting all the tags in order to delete everything this branch created.