From 749b8bc0ca31a9a2dbfcd7035d9bca6db9daf6d4 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Mon, 1 Jul 2024 17:41:27 +0200 Subject: [PATCH] fix(gitlab-ci-template.yml): heuristic to spot manually-run pipelines --- VERSION | 2 +- gitlab-ci-template.yml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 223df19..70016a7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.10.11 +0.10.12 diff --git a/gitlab-ci-template.yml b/gitlab-ci-template.yml index e3aca4f..c7a9dc9 100644 --- a/gitlab-ci-template.yml +++ b/gitlab-ci-template.yml @@ -103,7 +103,12 @@ prepare-artifacts: echo "CI_COMMIT_BEFORE_SHA=$CI_COMMIT_BEFORE_SHA" echo "CI_COMMIT_SHA=$CI_COMMIT_SHA" declare -a DOCKER_KEEPER_CMDS - if [ "$CI_COMMIT_BEFORE_SHA" != "$CI_COMMIT_SHA" ]; then + # The previous latest commit present on a branch or tag. + # Is always `0000000000000000000000000000000000000000` for + # merge request pipelines, the first commit in pipelines for branches or tags, + # *or when manually running a pipeline*. + # Remark for testing: coqbot+gitlab-ci may run 2 pipelines (branch/pull request) + if [ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then echo "Parsing commit message {|$CI_COMMIT_MESSAGE|}." readarray -t lines < <(grep "\(^\|(\| \|;\)docker-keeper)\?:" <<< "$CI_COMMIT_MESSAGE") for line in "${lines[@]}"; do