Skip to content

Update CI rule to build QA image for internal release

What does this MR do and why?

Build QA image for internal release

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

Screenshot 2025-06-06 at 13.13.12.png

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

Merge request reports

Loading