mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-10 02:22:57 +01:00
Cache chromium for arm64 builds
This commit is contained in:
parent
7d5f25b97e
commit
292fe33fba
7 changed files with 156 additions and 90 deletions
|
|
@ -1,32 +1,60 @@
|
|||
.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:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_SERVER_HOST == "gitlab.com"'
|
||||
variables:
|
||||
BASE_BUILD_REGISTRY_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images
|
||||
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_SERVER_HOST == "gitlab.com"'
|
||||
variables:
|
||||
PUSH_CUSTOM_IMAGE: "true"
|
||||
BASE_BUILD_REGISTRY_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images
|
||||
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_SERVER_HOST == "ops.gitlab.net" || $CI_SERVER_HOST == "dev.gitlab.org")'
|
||||
variables:
|
||||
PUSH_CUSTOM_IMAGE: "true"
|
||||
BASE_BUILD_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE
|
||||
|
||||
.cache-google-chrome:
|
||||
stage: automation
|
||||
extends: .install-qemu
|
||||
needs: []
|
||||
variables:
|
||||
ARCH: linux/amd64,linux/arm64
|
||||
before_script:
|
||||
- !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 $ARCH \
|
||||
-f "Dockerfile.cache-chrome" \
|
||||
.
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_SERVER_HOST == "gitlab.com"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_SERVER_HOST == "gitlab.com"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_SERVER_HOST == "gitlab.com"'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue