From 08ec2d2725707221a5b34d5dda3865339e208913 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 18 Apr 2024 20:12:30 +0200 Subject: [PATCH 1/5] Provide versions --- .gitlab-ci.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65f6d927b37..6d62136f3c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -232,9 +232,25 @@ onboarding_tests: variables: PRODUCT_NAME: auto_inject-ruby +save_versions: + stage: deploy + needs: [] + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: on_success + - when: manual + allow_failure: true + script: + - echo 1_X_COMMIT_SHA=$(git rev-parse 1.x-stable) >> upstream.env + - echo 2_X_COMMIT_SHA=$(git rev-parse master) >> upstream.env + artifacts: + paths: + - upstream.env + deploy_to_reliability_env: stage: deploy - needs: [] # This allows the job to run without prerequisites + needs: + - save_versions rules: - if: $CI_PIPELINE_SOURCE == "schedule" when: on_success @@ -248,6 +264,7 @@ deploy_to_reliability_env: UPSTREAM_PROJECT_ID: $CI_PROJECT_ID UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA + UPSTREAM_PACKAGE_JOB: save_versions prepare_image_destinations: stage: deploy From c75efb45e76940d5d645bed8b52e56f3dfed2e42 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Wed, 10 Jul 2024 15:59:57 +0200 Subject: [PATCH 2/5] Use ruby image that has `git` installed --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d62136f3c7..56963f3b861 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -233,6 +233,7 @@ onboarding_tests: PRODUCT_NAME: auto_inject-ruby save_versions: + image: $DOCKER_REGISTRY/images/mirror/ruby:3.2.2 stage: deploy needs: [] rules: From 530cb256425e4193bdf85f37509a463b03f84cc2 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Wed, 10 Jul 2024 17:20:33 +0200 Subject: [PATCH 3/5] `git fetch` before rev-parse --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56963f3b861..ba6ff5396bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -242,8 +242,9 @@ save_versions: - when: manual allow_failure: true script: - - echo 1_X_COMMIT_SHA=$(git rev-parse 1.x-stable) >> upstream.env - - echo 2_X_COMMIT_SHA=$(git rev-parse master) >> upstream.env + - git fetch --all + - echo 1_X_COMMIT_SHA=$(git rev-parse origin/1.x-stable) >> upstream.env + - echo 2_X_COMMIT_SHA=$(git rev-parse origin/master) >> upstream.env artifacts: paths: - upstream.env From 53beb046594604c7a6c90f4956a63ed8435397e4 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 12 Jul 2024 12:07:48 +0200 Subject: [PATCH 4/5] Add more variables for artifacts unpack --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba6ff5396bd..191a1898225 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -267,6 +267,8 @@ deploy_to_reliability_env: UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA UPSTREAM_PACKAGE_JOB: save_versions + UPSTREAM_PIPELINE_ID: $CI_PIPELINE_ID + CI_SERVER_URL: $CI_SERVER_URL prepare_image_destinations: stage: deploy From 9cf93d3531c9b6efe7a764c509f1e54e96ea0cfe Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 12 Jul 2024 12:34:45 +0200 Subject: [PATCH 5/5] Avoid environment starts with number --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 191a1898225..1128d2a8018 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -243,8 +243,8 @@ save_versions: allow_failure: true script: - git fetch --all - - echo 1_X_COMMIT_SHA=$(git rev-parse origin/1.x-stable) >> upstream.env - - echo 2_X_COMMIT_SHA=$(git rev-parse origin/master) >> upstream.env + - echo COMMIT_SHA_1X=$(git rev-parse origin/1.x-stable) >> upstream.env + - echo COMMIT_SHA_2X=$(git rev-parse origin/master) >> upstream.env artifacts: paths: - upstream.env