Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 3e389e1e authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

feat: autoclean tmp container image on tag

parent 2aa025cf
No related branches found
No related tags found
No related merge requests found
Pipeline #2293 failed
......@@ -30,6 +30,7 @@ container:purge:
image: buildpack-deps:buster-curl
stage: clean
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
REG_SHA256: ade837fc5224acd8c34732bf54a94f579b47851cc6a7fd5899a98386b782e228
......@@ -40,11 +41,21 @@ container:purge:
- echo "$REG_SHA256 /usr/local/bin/reg" | sha256sum -c -
- chmod a+x /usr/local/bin/reg
- cd ${working_directory}
script: |
if (echo ${CI_COMMIT_TITLE} | grep "Merge branch '.*' into 'master'"); then
echo "It's a merge commit \o/"
script: |
clean_images=false
if [[ -n "${CI_COMMIT_TAG}" ]]; then
echo "It's a tag 🔖"
SOURCE_BRANCH=${CI_DEFAULT_BRANCH}
clean_images=true
elif (echo ${CI_COMMIT_TITLE} | grep "Merge branch '.*' into 'master'"); then
echo "It's a merge 🔀"
SOURCE_BRANCH=$(echo $CI_COMMIT_TITLE | cut -d "'" -f 2)
echo "Source branch of the merge ${SOURCE_BRANCH}"
clean_images=true
fi
if [[ "${clean_images}" = true ]]; then
echo "Source branch to purge : ${SOURCE_BRANCH}"
# Namespace
container_namespace="${CI_PROJECT_PATH}/branch-${SOURCE_BRANCH//\//_}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment