Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v2] gitlab-ci: remove tag from pushed branch commit
@ 2020-10-15  4:19 Alexander V. Tikhonov
  2020-10-15  9:24 ` Alexander Turenko
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander V. Tikhonov @ 2020-10-15  4:19 UTC (permalink / raw)
  To: Alexander Turenko, Kirill Yukhin; +Cc: tarantool-patches

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 <alexander.turenko@tarantool.org>
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-force-push-live
Issue: https://github.com/tarantool/tarantool/issues/3745

 .gitlab-ci.yml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d40dc74e3..848855b8e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,12 +26,19 @@ variables:
 #    gitlab-runner user is not known).
 # 3) 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.
+# 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.
+# 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 "! 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"
 
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] gitlab-ci: remove tag from pushed branch commit
  2020-10-15  4:19 [Tarantool-patches] [PATCH v2] gitlab-ci: remove tag from pushed branch commit Alexander V. Tikhonov
@ 2020-10-15  9:24 ` Alexander Turenko
  2020-10-15 13:03   ` Alexander Turenko
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Turenko @ 2020-10-15  9:24 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

On Thu, Oct 15, 2020 at 07:19:31AM +0300, Alexander V. Tikhonov wrote:
> 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 <alexander.turenko@tarantool.org>
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-force-push-live
> Issue: https://github.com/tarantool/tarantool/issues/3745
> 
>  .gitlab-ci.yml | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index d40dc74e3..848855b8e 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -26,12 +26,19 @@ variables:
>  #    gitlab-runner user is not known).
>  # 3) 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.
> +# 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.
> +# 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 "! 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"

I already fixed it by s/HEAD/${CI_COMMIT_SHORT_SHA}/ (and left it be the
second command) and pushed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] gitlab-ci: remove tag from pushed branch commit
  2020-10-15  9:24 ` Alexander Turenko
@ 2020-10-15 13:03   ` Alexander Turenko
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Turenko @ 2020-10-15 13:03 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

On Thu, Oct 15, 2020 at 12:24:41PM +0300, Alexander Turenko wrote:
> On Thu, Oct 15, 2020 at 07:19:31AM +0300, Alexander V. Tikhonov wrote:
> > 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 <alexander.turenko@tarantool.org>
> > ---
> > 
> > Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-force-push-live
> > Issue: https://github.com/tarantool/tarantool/issues/3745
> > 
> >  .gitlab-ci.yml | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index d40dc74e3..848855b8e 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -26,12 +26,19 @@ variables:
> >  #    gitlab-runner user is not known).
> >  # 3) 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.
> > +# 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.
> > +# 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 "! 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"
> 
> I already fixed it by s/HEAD/${CI_COMMIT_SHORT_SHA}/ (and left it be the
> second command) and pushed.

As Alexander pointed me, we should drop a tag after `git fetch`. My bad
(again). Updated on master, 2.5, 2.4 and 1.10 as follows:

commit 0f575e01a20a2da76d73e72e77f6ebd0080ef1b1
Author: Alexander Turenko <alexander.turenko@tarantool.org>
Date:   Thu Oct 15 15:51:22 2020 +0300

    gitlab-ci: fix tag removal for a branch push job
    
    We should remove a tag after fetching of a remote repository.
    
    It is hotfix of commit 0f564f3497e6a8afd42da2175104118ba5213593
    ('gitlab-ci: remove tag from pushed branch commit').
    
    Follows up #3745
    
    Co-authored-by: Alexander V. Tikhonov <avtikhon@tarantool.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 64986e60a..848855b8e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,24 +21,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"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-15 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  4:19 [Tarantool-patches] [PATCH v2] gitlab-ci: remove tag from pushed branch commit Alexander V. Tikhonov
2020-10-15  9:24 ` Alexander Turenko
2020-10-15 13:03   ` Alexander Turenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox