diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-18 09:08:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-18 09:08:32 +0300 |
commit | 55e0080f9d6b971145ee95c62dbb65feacaa93f8 (patch) | |
tree | 0d9db86b8745512327d1c35edc7375f7378199a8 /scripts | |
parent | 962afb3da11a72c7fca322378886b2c0be9f3385 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_gdk_image | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/build_gdk_image b/scripts/build_gdk_image new file mode 100755 index 00000000000..540c60a990e --- /dev/null +++ b/scripts/build_gdk_image @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +source "$(dirname "$0")/utils.sh" + +REGISTRY="${CI_REGISTRY}/${CI_PROJECT_PATH}" +SHA_TAG="${CI_COMMIT_SHA}" +BRANCH_TAG="${CI_COMMIT_REF_SLUG}" +BASE_TAG=$([ "${BUILD_GDK_BASE}" == "true" ] && echo "${SHA_TAG}" || echo "master") + +function build_image() { + local image=$1 + local target=$2 + + docker buildx build \ + --cache-to="type=inline" \ + --cache-from="${image}:${BRANCH_TAG}" \ + --cache-from="${image}:master" \ + --file="qa/gdk/Dockerfile.gdk" \ + --target="${target}" \ + --platform=${ARCH:-amd64} \ + --tag="${image}:${SHA_TAG}" \ + --tag="${image}:${BRANCH_TAG}" \ + --build-arg="BASE_TAG=${BASE_TAG}" \ + --push \ + . +} + +# Rebuild base image when BUILD_GDK_BASE is set to true +if [[ "${BUILD_GDK_BASE}" == "true" ]]; then + echoinfo "Building GDK base image", "yes" + build_image "${REGISTRY}/gitlab-qa-gdk-base" "gdk-base" +fi + +echoinfo "Building GDK image", "yes" +build_image "${REGISTRY}/gitlab-qa-gdk" "gdk" + +echosuccess "Built image '${REGISTRY}/gitlab-qa-gdk:${SHA_TAG}'" |