Commit d22e3862 authored by Rémy Coutable's avatar Rémy Coutable

ci: Tag QA image with the commit SHA instead of branch name

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent b8ee0f3e
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
- if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then - if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
echo "Checking out \$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ($CI_MERGE_REQUEST_SOURCE_BRANCH_SHA) instead of \$CI_COMMIT_SHA (merge result commit $CI_COMMIT_SHA) so that GitLab image built in omnibus-gitlab-mirror and QA image are in sync."; echo "Checking out \$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ($CI_MERGE_REQUEST_SOURCE_BRANCH_SHA) instead of \$CI_COMMIT_SHA (merge result commit $CI_COMMIT_SHA) so that GitLab image built in omnibus-gitlab-mirror and QA image are in sync.";
git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}; git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA};
export QA_IMAGE_TAG=$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA;
else else
echo "Building the image from \$CI_COMMIT_SHA ($CI_COMMIT_SHA) for this non-merge result pipeline."; echo "Building the image from \$CI_COMMIT_SHA ($CI_COMMIT_SHA) for this non-merge result pipeline.";
export QA_IMAGE_TAG=$CI_COMMIT_SHA;
fi; fi;
- echo "See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results for more details."; - echo "See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results for more details.";
retry: 2 retry: 2
...@@ -25,10 +27,9 @@ build-qa-image: ...@@ -25,10 +27,9 @@ build-qa-image:
- .build-images:rules:build-qa-image - .build-images:rules:build-qa-image
stage: build-images stage: build-images
needs: [] needs: []
variables:
QA_IMAGE: "${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${CI_COMMIT_REF_SLUG}"
script: script:
- !reference [.base-image-build, script] - !reference [.base-image-build, script]
- 'export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${QA_IMAGE_TAG}"'
- /kaniko/executor --context=${CI_PROJECT_DIR} --dockerfile=${CI_PROJECT_DIR}/qa/Dockerfile --destination=${QA_IMAGE} --cache=true - /kaniko/executor --context=${CI_PROJECT_DIR} --dockerfile=${CI_PROJECT_DIR}/qa/Dockerfile --destination=${QA_IMAGE} --cache=true
# This image is used by: # This image is used by:
......
...@@ -51,9 +51,16 @@ update-qa-cache: ...@@ -51,9 +51,16 @@ update-qa-cache:
image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine
stage: qa stage: qa
retry: 0 retry: 0
script: before_script:
- if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
export QA_IMAGE_TAG=$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA;
else
export QA_IMAGE_TAG=$CI_COMMIT_SHA;
fi;
- 'export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab-ee-qa:${QA_IMAGE_TAG}"'
- source scripts/utils.sh - source scripts/utils.sh
- install_gitlab_gem - install_gitlab_gem
script:
- ./scripts/trigger-build omnibus - ./scripts/trigger-build omnibus
package-and-qa: package-and-qa:
......
...@@ -143,7 +143,7 @@ module Trigger ...@@ -143,7 +143,7 @@ module Trigger
{ {
'GITLAB_VERSION' => source_sha, 'GITLAB_VERSION' => source_sha,
'IMAGE_TAG' => source_sha, 'IMAGE_TAG' => source_sha,
'QA_IMAGE' => "#{ENV['CI_REGISTRY']}/#{ENV['CI_PROJECT_PATH']}/gitlab-ee-qa:#{ENV['CI_COMMIT_REF_SLUG']}", 'QA_IMAGE' => ENV['QA_IMAGE'],
'SKIP_QA_DOCKER' => 'true', 'SKIP_QA_DOCKER' => 'true',
'ALTERNATIVE_SOURCES' => 'true', 'ALTERNATIVE_SOURCES' => 'true',
'SECURITY_SOURCES' => Trigger.security? ? 'true' : 'false', 'SECURITY_SOURCES' => Trigger.security? ? 'true' : 'false',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment