blob: 540c60a990e96798647770cd1ff239bafaf063dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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}'"
|