Update pipeline setup

This commit is contained in:
Andrejs Cunskis 2022-08-22 11:38:13 +03:00
parent f6beca8712
commit 9d5972d125
No known key found for this signature in database
GPG key ID: 87CB75083F227241
3 changed files with 21 additions and 9 deletions

View file

@ -21,6 +21,7 @@ stages:
variables:
DOCKER_HOST: tcp://docker:2375
BASE_BUILD_REGISTRY_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images
cache-chrome-chromium:
extends: .cache-google-chrome

View file

@ -1,21 +1,27 @@
.build_and_push:
stage: custom
needs: []
.install-qemu:
timeout: 2 hours # builds with emulation can take a long time to complete
tags:
- docker
- high-cpu
variables:
QEMU_IMAGE: tonistiigi/binfmt:qemu-v6.2.0
timeout: 2 hours
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
- |
if [ "${ARCH:-amd64}" != "amd64" ]; then
if [ "$PUSH_CUSTOM_IMAGE" == "true" ]; then
echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
fi
- |
if [[ "${ARCH:-amd64}" =~ arm64 ]]; then
echo -e "\033[1;33mInstalling latest qemu emulators\033[0m"
docker pull -q ${QEMU_IMAGE};
docker run --rm --privileged ${QEMU_IMAGE} --uninstall qemu-*;
docker run --rm --privileged ${QEMU_IMAGE} --install all;
fi
.build_and_push:
stage: custom
extends: .install-qemu
needs: []
script:
- ./scripts/lib/custom-docker-build
rules:
@ -33,16 +39,20 @@
.cache-google-chrome:
stage: automation
extends: .install-qemu
needs: []
variables:
ARCH: linux/amd64,linux/arm64
before_script:
- docker buildx create --use
- !reference [.install-qemu, before_script]
- docker buildx create --use # creates context that's capable of building multiple architectures in parallel
script:
- |
docker buildx build \
--build-arg CI_API_V4_URL=$CI_API_V4_URL \
--build-arg CI_PROJECT_ID=$CI_PROJECT_ID \
--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN \
--platform linux/amd64,linux/arm64 \
--platform $ARCH \
-f "Dockerfile.cache-chrome" \
.
rules:

View file

@ -84,8 +84,9 @@ function cache-chromium() {
fi
}
echo "Updating system utils"
apt-get -y -qq update
apt-get -y install apt-utils curl bash gnupg2 > /dev/null
apt-get -y install apt-utils curl gnupg2 > /dev/null
if [ "$TARGETARCH" == "amd64" ]; then
cache-chrome