2022-09-23 11:11:09 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
QA_IMAGE_NAME="gitlab-ee-qa"
|
|
|
|
|
|
|
|
if [ "${CI_PROJECT_NAME}" == "gitlabhq" ] || [ "${CI_PROJECT_NAME}" == "gitlab-foss" ]; then
|
|
|
|
QA_IMAGE_NAME="gitlab-ce-qa"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Tag with commit SHA by default
|
|
|
|
QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/${QA_IMAGE_NAME}:${CI_COMMIT_SHA}"
|
2022-11-09 07:07:48 -05:00
|
|
|
|
2022-09-23 11:11:09 -04:00
|
|
|
# For branches, tag with slugified branch name. For tags, use the tag directly
|
2022-11-09 07:07:48 -05:00
|
|
|
# with v prefix removed
|
|
|
|
IMAGE_TAG=${CI_COMMIT_TAG#v}
|
|
|
|
IMAGE_TAG=${IMAGE_TAG:-$CI_COMMIT_REF_SLUG}
|
|
|
|
|
|
|
|
QA_IMAGE_BRANCH="${CI_REGISTRY}/${CI_PROJECT_PATH}/${QA_IMAGE_NAME}:${IMAGE_TAG}"
|
2022-09-23 11:11:09 -04:00
|
|
|
|
|
|
|
DESTINATIONS="--destination=${QA_IMAGE} --destination=${QA_IMAGE_BRANCH}"
|
|
|
|
|
|
|
|
# Auto-deploy tag format uses first 12 letters of commit SHA. Tag with that
|
|
|
|
# reference also for EE images.
|
|
|
|
if [ "${QA_IMAGE_NAME}" == "gitlab-ee-qa" ]; then
|
|
|
|
QA_IMAGE_FOR_AUTO_DEPLOY="${CI_REGISTRY}/${CI_PROJECT_PATH}/${QA_IMAGE_NAME}:${CI_COMMIT_SHA:0:11}"
|
|
|
|
DESTINATIONS="${DESTINATIONS} --destination=$QA_IMAGE_FOR_AUTO_DEPLOY"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building QA image for destinations: ${DESTINATIONS}"
|
|
|
|
|
|
|
|
/kaniko/executor \
|
|
|
|
--context="${CI_PROJECT_DIR}" \
|
|
|
|
--dockerfile="${CI_PROJECT_DIR}/qa/Dockerfile" \
|
|
|
|
--build-arg=CHROME_VERSION="${CHROME_VERSION}" \
|
|
|
|
--build-arg=DOCKER_VERSION="${DOCKER_VERSION}" \
|
2022-10-21 08:11:29 -04:00
|
|
|
--build-arg=RUBY_VERSION="${RUBY_VERSION}" \
|
2022-09-23 11:11:09 -04:00
|
|
|
--build-arg=QA_BUILD_TARGET="${QA_BUILD_TARGET:-qa}" \
|
|
|
|
--cache=true \
|
|
|
|
${DESTINATIONS}
|