Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits
@ 2020-09-02 10:25 Alexander V. Tikhonov
  2020-09-11 13:16 ` Sergey Bronnikov
  2020-09-15 15:14 ` Kirill Yukhin
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander V. Tikhonov @ 2020-09-02 10:25 UTC (permalink / raw)
  To: Kirill Yukhin, Alexander Turenko; +Cc: tarantool-patches

Found that tagged commits were not run the deployment gitlab-ci jobs.
To fix it added 'tags' label for deployment and perfomance jobs. Also
found that after the commit tagged it has tag label in format 'x^0'
and all previous commits till the previous tag became to have tags in
format 'x~<commits before>' like 'x~1' or 'x~2' and etc. So the check

  if git name-rev --name-only --tags --no-undefined HEAD ; then

became always pass and previous commits on rerun could began to deploy.
To fix it was used gitlab-ci environment variable 'CI_COMMIT_TAG', it
shows in real if the current commit has tag and has to be deployed.

Part of #3745
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-gitlab-ci-tags
Issue: https://github.com/tarantool/tarantool/issues/3745

 .gitlab-ci.yml | 3 +++
 .gitlab.mk     | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 05d40b013..c144aae9c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,6 +38,7 @@ before_script:
 .deploy_only_template: &deploy_only_definition
   only:
     - master
+    - tags
   except:
     - schedules
     - external_pull_requests
@@ -46,10 +47,12 @@ before_script:
 .pack_only_template: &pack_only_definition
   except:
     - master
+    - tags
 
 .perf_only_template: &perf_only_definition
   only:
     - master
+    - tags
     - /^.*-perf$/
   except:
     - schedules
diff --git a/.gitlab.mk b/.gitlab.mk
index 0ce978063..1b3ffddcc 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -121,7 +121,7 @@ deploy: package
 	echo ${GPG_SECRET_KEY} | base64 -d | gpg --batch --import || true
 	./tools/update_repo.sh -o=${OS} -d=${DIST} \
 		-b="${LIVE_REPO_S3_DIR}/${BUCKET}" build
-	if git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null ; then \
+	if [ "${CI_COMMIT_TAG}" != "" ]; then \
 		./tools/update_repo.sh -o=${OS} -d=${DIST} \
 			-b="${RELEASE_REPO_S3_DIR}/${BUCKET}" build ; \
 	fi
-- 
2.17.1

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

* Re: [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits
  2020-09-02 10:25 [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits Alexander V. Tikhonov
@ 2020-09-11 13:16 ` Sergey Bronnikov
  2020-09-15 15:14 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Bronnikov @ 2020-09-11 13:16 UTC (permalink / raw)
  To: Alexander V. Tikhonov, Kirill Yukhin, Alexander Turenko; +Cc: tarantool-patches

LGTM

Although there is a thing I'm worry about: CI_COMMIT_TAG

is an environment variable specific for GitLab CI. Travis CI and GitHub 
Actions

doesn't export such variable and condition will works always.


1. https://docs.travis-ci.com/user/environment-variables/

2. 
https://docs.gitlab.com/ee/ci/variables/README.html#predefined-environment-variables

3. 
https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables


On 02.09.2020 13:25, Alexander V. Tikhonov wrote:
> Found that tagged commits were not run the deployment gitlab-ci jobs.
> To fix it added 'tags' label for deployment and perfomance jobs. Also
> found that after the commit tagged it has tag label in format 'x^0'
> and all previous commits till the previous tag became to have tags in
> format 'x~<commits before>' like 'x~1' or 'x~2' and etc. So the check
>
>    if git name-rev --name-only --tags --no-undefined HEAD ; then
>
> became always pass and previous commits on rerun could began to deploy.
> To fix it was used gitlab-ci environment variable 'CI_COMMIT_TAG', it
> shows in real if the current commit has tag and has to be deployed.
>
> Part of #3745
> ---
>
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-gitlab-ci-tags
> Issue: https://github.com/tarantool/tarantool/issues/3745
>
>   .gitlab-ci.yml | 3 +++
>   .gitlab.mk     | 2 +-
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 05d40b013..c144aae9c 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -38,6 +38,7 @@ before_script:
>   .deploy_only_template: &deploy_only_definition
>     only:
>       - master
> +    - tags
>     except:
>       - schedules
>       - external_pull_requests
> @@ -46,10 +47,12 @@ before_script:
>   .pack_only_template: &pack_only_definition
>     except:
>       - master
> +    - tags
>   
>   .perf_only_template: &perf_only_definition
>     only:
>       - master
> +    - tags
>       - /^.*-perf$/
>     except:
>       - schedules
> diff --git a/.gitlab.mk b/.gitlab.mk
> index 0ce978063..1b3ffddcc 100644
> --- a/.gitlab.mk
> +++ b/.gitlab.mk
> @@ -121,7 +121,7 @@ deploy: package
>   	echo ${GPG_SECRET_KEY} | base64 -d | gpg --batch --import || true
>   	./tools/update_repo.sh -o=${OS} -d=${DIST} \
>   		-b="${LIVE_REPO_S3_DIR}/${BUCKET}" build
> -	if git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null ; then \
> +	if [ "${CI_COMMIT_TAG}" != "" ]; then \
>   		./tools/update_repo.sh -o=${OS} -d=${DIST} \
>   			-b="${RELEASE_REPO_S3_DIR}/${BUCKET}" build ; \
>   	fi

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

* Re: [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits
  2020-09-02 10:25 [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits Alexander V. Tikhonov
  2020-09-11 13:16 ` Sergey Bronnikov
@ 2020-09-15 15:14 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2020-09-15 15:14 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches, Alexander Turenko

Hello,

On 02 сен 13:25, Alexander V. Tikhonov wrote:
> Found that tagged commits were not run the deployment gitlab-ci jobs.
> To fix it added 'tags' label for deployment and perfomance jobs. Also
> found that after the commit tagged it has tag label in format 'x^0'
> and all previous commits till the previous tag became to have tags in
> format 'x~<commits before>' like 'x~1' or 'x~2' and etc. So the check
> 
>   if git name-rev --name-only --tags --no-undefined HEAD ; then
> 
> became always pass and previous commits on rerun could began to deploy.
> To fix it was used gitlab-ci environment variable 'CI_COMMIT_TAG', it
> shows in real if the current commit has tag and has to be deployed.
> 
> Part of #3745
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3745-gitlab-ci-tags
> Issue: https://github.com/tarantool/tarantool/issues/3745

I've checked your patch into 1.10, 2.4, 2.5 and master.

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2020-09-15 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 10:25 [Tarantool-patches] [PATCH v1] gitlab-ci: fix deployment of tagged commits Alexander V. Tikhonov
2020-09-11 13:16 ` Sergey Bronnikov
2020-09-15 15:14 ` Kirill Yukhin

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