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: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
BASE_BUILD_REGISTRY_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images
cache-chrome-chromium: cache-chrome-chromium:
extends: .cache-google-chrome extends: .cache-google-chrome

View file

@ -1,21 +1,27 @@
.build_and_push: .install-qemu:
stage: custom timeout: 2 hours # builds with emulation can take a long time to complete
needs: []
tags: tags:
- docker - docker
- high-cpu - high-cpu
variables: variables:
QEMU_IMAGE: tonistiigi/binfmt:qemu-v6.2.0 QEMU_IMAGE: tonistiigi/binfmt:qemu-v6.2.0
timeout: 2 hours
before_script: 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" echo -e "\033[1;33mInstalling latest qemu emulators\033[0m"
docker pull -q ${QEMU_IMAGE}; docker pull -q ${QEMU_IMAGE};
docker run --rm --privileged ${QEMU_IMAGE} --uninstall qemu-*; docker run --rm --privileged ${QEMU_IMAGE} --uninstall qemu-*;
docker run --rm --privileged ${QEMU_IMAGE} --install all; docker run --rm --privileged ${QEMU_IMAGE} --install all;
fi fi
.build_and_push:
stage: custom
extends: .install-qemu
needs: []
script: script:
- ./scripts/lib/custom-docker-build - ./scripts/lib/custom-docker-build
rules: rules:
@ -33,16 +39,20 @@
.cache-google-chrome: .cache-google-chrome:
stage: automation stage: automation
extends: .install-qemu
needs: [] needs: []
variables:
ARCH: linux/amd64,linux/arm64
before_script: 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: script:
- | - |
docker buildx build \ docker buildx build \
--build-arg CI_API_V4_URL=$CI_API_V4_URL \ --build-arg CI_API_V4_URL=$CI_API_V4_URL \
--build-arg CI_PROJECT_ID=$CI_PROJECT_ID \ --build-arg CI_PROJECT_ID=$CI_PROJECT_ID \
--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN \ --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN \
--platform linux/amd64,linux/arm64 \ --platform $ARCH \
-f "Dockerfile.cache-chrome" \ -f "Dockerfile.cache-chrome" \
. .
rules: rules:

View file

@ -84,8 +84,9 @@ function cache-chromium() {
fi fi
} }
echo "Updating system utils"
apt-get -y -qq update 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 if [ "$TARGETARCH" == "amd64" ]; then
cache-chrome cache-chrome