Skip to content

Commit

Permalink
gitlab-ci: fix tag removal for a branch push job
Browse files Browse the repository at this point in the history
We should remove a tag after fetching of a remote repository.

It is hotfix of commit 0f564f3
('gitlab-ci: remove tag from pushed branch commit').

Follows up #3745

Co-authored-by: Alexander V. Tikhonov <avtikhon@tarantool.org>
(cherry picked from commit 0f575e0)
  • Loading branch information
Totktonada committed Oct 15, 2020
1 parent 2d530ff commit 2fb358d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Expand Up @@ -20,24 +20,24 @@ 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) Drop a tag that points to a current commit (if any) on a job triggered by
# 2) 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
# of the testing commit.
# 4) 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).
# 4) Fetch Tarantool sources with branches and force checkout
# of the testing commit.
# 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 \"${CI_COMMIT_SHORT_SHA}\")\" 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 "[ -z \"${CI_COMMIT_TAG:-}\" ] && git tag -d \"$(git tag --points-at HEAD)\" 2>/dev/null || true"
- /bin/bash -c "git submodule sync --recursive && git submodule update --force --init --recursive || git submodule update --recursive --init"
- /bin/bash -c "git clean -ffdx && git submodule foreach git clean -ffdx && git submodule foreach git status"

Expand Down

0 comments on commit 2fb358d

Please sign in to comment.