mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-08 17:42:56 +01:00
105 lines
3.1 KiB
YAML
105 lines
3.1 KiB
YAML
.install-qemu:
|
|
timeout: 4 hours # builds with emulation can take a long time to complete
|
|
tags:
|
|
- saas-linux-2xlarge-amd64 # use largest instance for better performance for arm64 builds
|
|
variables:
|
|
QEMU_IMAGE: tonistiigi/binfmt:qemu-v7.0.0
|
|
before_script:
|
|
- |
|
|
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
|
|
- docker buildx create --use # creates and set's to active buildkit builder
|
|
|
|
.with-built-image-artifact:
|
|
artifacts:
|
|
paths: ["*-built-image.txt"]
|
|
expire_in: 7d
|
|
|
|
.build_dynamic_image:
|
|
stage: custom
|
|
extends:
|
|
- .install-qemu
|
|
- .with-built-image-artifact
|
|
needs: []
|
|
script:
|
|
- ./scripts/lib/custom-docker-build
|
|
rules:
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
when: never
|
|
|
|
.build_static_image:
|
|
stage: custom
|
|
extends:
|
|
- .install-qemu
|
|
- .with-built-image-artifact
|
|
needs: []
|
|
script:
|
|
# Hack to set an array in /bin/sh
|
|
# http://unix.stackexchange.com/a/137571
|
|
- set -- $CI_JOB_NAME
|
|
- export IMAGE_NAME=${1/:/}
|
|
- |
|
|
docker buildx build \
|
|
--cache-to=type=inline \
|
|
--cache-from="$CI_REGISTRY_IMAGE:$IMAGE_NAME" \
|
|
--platform=linux/${ARCH:-amd64} \
|
|
--push="${PUSH_CUSTOM_IMAGE:-false}" \
|
|
--label "ci_pipeline_url=$CI_PIPELINE_URL" \
|
|
--label "ci_job_url=$CI_JOB_URL" \
|
|
-t "$CI_REGISTRY_IMAGE:$IMAGE_NAME" \
|
|
-f "Dockerfile.$IMAGE_NAME" \
|
|
.
|
|
rules:
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
when: never
|
|
- if: '$CI_MERGE_REQUEST_IID'
|
|
changes:
|
|
- "Dockerfile.${CI_JOB_NAME}"
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
changes:
|
|
- "Dockerfile.${CI_JOB_NAME}"
|
|
# In all other cases, make the job manual
|
|
- when: manual
|
|
allow_failure: true
|
|
|
|
.cache-google-chrome:
|
|
stage: automation
|
|
extends: .install-qemu
|
|
needs: []
|
|
variables:
|
|
ARCH: linux/amd64,linux/arm64
|
|
parallel:
|
|
matrix:
|
|
- BUILD_OS: debian
|
|
OS_VERSION: [bullseye, bookworm]
|
|
NOTIFY_VERSION_UPDATE: "true"
|
|
before_script:
|
|
- !reference [.install-qemu, before_script]
|
|
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 \
|
|
--build-arg CI_SLACK_WEBHOOK_URL=$CI_SLACK_WEBHOOK_URL \
|
|
--build-arg BUILD_OS=$BUILD_OS \
|
|
--build-arg OS_VERSION=$OS_VERSION \
|
|
--platform $ARCH \
|
|
-f "Dockerfile.cache-chrome" \
|
|
.
|
|
rules:
|
|
- if: '$CI_SERVER_HOST != "gitlab.com"'
|
|
when: never
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
- if: '$CI_MERGE_REQUEST_IID'
|
|
when: manual
|
|
allow_failure: true
|