Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build_gdk_image « scripts - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8b1fdec2d7d61b2878d96643ab95b24f73295691 (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
#!/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}"

# Fetch ruby version based on contents of .ruby-version
RUBY_VERSION=$(cat .ruby-version)
RUBY_VERSION_MINOR=$(echo "$RUBY_VERSION" | awk -F. '{$3=0; OFS="."; print $1,$2,$3}')

IMAGE="${REGISTRY}/gitlab-qa-gdk"

if [[ -n "${CI}" ]]; then
  OUTPUT_OPTION="--push"
else
  OUTPUT_OPTION="--load"
fi

echoinfo "Building GDK image with GDK sha: '${GDK_SHA}'" "yes"

docker buildx build \
  --cache-to="type=inline" \
  --cache-from="${IMAGE}:${BRANCH_TAG}" \
  --cache-from="${IMAGE}:master" \
  --file="qa/gdk/Dockerfile.gdk" \
  --platform=${ARCH:-amd64} \
  --tag="${IMAGE}:${SHA_TAG}" \
  --tag="${IMAGE}:${BRANCH_TAG}" \
  --build-arg="GEM_CACHE=/home/gdk/.asdf/installs/ruby/${RUBY_VERSION}/lib/ruby/gems/${RUBY_VERSION_MINOR}/cache" \
  ${OUTPUT_OPTION} \
  .

echosuccess "Built image '${REGISTRY}/gitlab-qa-gdk:${SHA_TAG}'"