diff --git a/.gitlab/ci/cleanup_tags.yml b/.gitlab/ci/cleanup_tags.yml new file mode 100644 index 0000000000000000000000000000000000000000..bd04c26f9d20366c1128df891651212a29313197 --- /dev/null +++ b/.gitlab/ci/cleanup_tags.yml @@ -0,0 +1,22 @@ +.cleanup_tags: + stage: deploy + image: curlimages/curl + variables: + FPM_IMAGE_REPOSITORY_ID: 415 + NGINX_IMAGE_REPOSITORY_ID: 416 + API_DELETE_PATH: /projects/$CI_PROJECT_ID/registry/repositories/:repository_id/tags + script: + # Delete all composer image tags for this branch as we don't need them anymore + - > + curl -X DELETE -k -H 'Content-Type: application/json' + -H "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" + -i "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/registry/repositories/${FPM_IMAGE_REPOSITORY_ID}/tags" + --data "{\"name_regex_delete\": \"$CI_COMMIT_REF_SLUG-composer-.*\"}" + +cleanup_tags_review: + extends: cleanup_tags + rules: + - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + \ No newline at end of file