From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1AB71469719 for ; Wed, 14 Oct 2020 23:59:43 +0300 (MSK) From: "Alexander V. Tikhonov" Date: Wed, 14 Oct 2020 23:59:41 +0300 Message-Id: <8c07da569ada1bdc06a3edaa4425738fd7f0d89a.1602709112.git.avtikhon@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v1] gitlab-ci: remove tag from pushed branch commit List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko , Kirill Yukhin Cc: tarantool-patches@dev.tarantool.org Drop a tag that points to a current commit (if any) on a job triggered by pushing to a branch (as against of pushing a tag). Otherwise we may get two jobs for the same x.y.z-0-gxxxxxxxxx build: one is run by pushing a branch and another by pushing a tag. The idea is to hide the new tag from the branch job as if a tag would be pushed strictly after all branch jobs for the same commit. Closes #3745 Co-authored-by: Alexander Turenko --- Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-force-push-live Issue: https://github.com/tarantool/tarantool/issues/3745 .gitlab-ci.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d40dc74e3..4166443c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,15 +21,22 @@ variables: # https://docs.gitlab.com/ee/ci/yaml/README.html#git-submodule-strategy # List of steps: # 1) Check/clone the Tarantool repository with submodules. -# 2) For shell based jobs change ownership of all the sources +# 2) Drop a tag that points to a current commit (if any) on a job triggered by +# pushing to a branch (as against of pushing a tag). Otherwise we may get +# two jobs for the same x.y.z-0-gxxxxxxxxx build: one is run by pushing a +# branch and another by pushing a tag. The idea is to hide the new tag from +# the branch job as if a tag would be pushed strictly after all branch jobs +# for the same commit. See gh-3745. +# 3) For shell based jobs change ownership of all the sources # to gitlab-runner user (NOTE: in Docker based jobs the # gitlab-runner user is not known). -# 3) Fetch Tarantool sources with branches and force checkout +# 4) Fetch Tarantool sources with branches and force checkout # of the testing commit. -# 4) Update submodules recursively (use force where supports). -# 5) Cleanup all the sources from all files except from repository. +# 5) Update submodules recursively (use force where supports). +# 6) Cleanup all the sources from all files except from repository. before_script: - /bin/bash -c "pwd && ls -d .git || git clone --recurse-submodules ${CI_REPOSITORY_URL} ." + - /bin/bash -c "[ -z \"${CI_COMMIT_TAG:-}\" ] && git tag -d \"$(git tag --points-at HEAD)\" 2>/dev/null || true" - /bin/bash -c "! docker -v || (uid=`id -u` ; gid=`id -g` ; docker run -w /source -v ${PWD}:/source -i packpack/packpack:el-7 /bin/bash -c \"chown -R \$uid:\$gid * .[^.]*\")" - /bin/bash -c "git fetch -p && git checkout -f ${CI_COMMIT_SHORT_SHA}" - /bin/bash -c "git submodule sync --recursive && git submodule update --force --init --recursive || git submodule update --recursive --init" -- 2.25.1