Update CI rule to build QA image for internal release
What does this MR do and why?
Build QA image for internal release
- Add a new CI rule to build QA image for internal release on
dev.gitlab.org - Adapt the logic to tag internal release QA image in
build_qa_imageto the new commit meassage which is "Update VERSION file for <internal-release-version" (https://gitlab.com/gitlab-org/release-tools/-/blob/7c7d30314f74c9d4dea3b82db1cd2bb44b9c8154/lib/release_tools/internal_release/update_version_file.rb#L61)
References
gitlab-com/gl-infra/delivery#20850 (closed)
Testing
To perform the tests, I use the same rule added in this MR in my test repo at https://dev.gitlab.org/dat.tang.gitlab/test-project
With the script:
script
#!/bin/bash
CI_REGISTRY="dev.gitlab.org:5005"
QA_IMAGE_NAME="gitlab-ee-qa"
BASE_IMAGE_PATH="${CI_REGISTRY}/${CI_PROJECT_PATH}/${QA_IMAGE_NAME}"
function version_file_content() {
cat "${CI_PROJECT_DIR}/VERSION" 2>/dev/null || echo ""
}
if [[ "${QA_IMAGE_NAME}" == "gitlab-ee-qa" ]] && \
[[ "${CI_REGISTRY}" == "dev.gitlab.org:5005" ]] && \
[[ "$CI_COMMIT_TITLE" =~ ^Update\ VERSION\ file.*internal ]]; then
QA_IMAGE_FOR_INTERNAL_RELEASE="${BASE_IMAGE_PATH}:$(version_file_content)"
DESTINATIONS="${DESTINATIONS} --tag ${QA_IMAGE_FOR_INTERNAL_RELEASE}"
fi
echo "${DESTINATIONS}"
CI config
.if-dev-internal-release: &if-dev-internal-release
if: '$CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_PATH == "dat.tang.gitlab/test-project" && $CI_COMMIT_TITLE =~ /^Update VERSION file.*internal/'
.build-images:rules:build-qa-image:
rules:
- <<: *if-dev-internal-release
stages:
- build-images
build-qa-image:
extends:
- .build-images:rules:build-qa-image
stage: build-images
needs: []
script:
- bash scripts/build_qa_image
It returned the expected image tag --tag dev.gitlab.org:5005/dat.tang.gitlab/test-project/gitlab-ee-qa:100.100.1-internal2
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Dat Tang
