Skip to content

Commit

Permalink
gitlab-ci: Replace Docker with Kaniko
Browse files Browse the repository at this point in the history
Enables caching from the qemu-project repository.

Uses a dedicated "$NAME-cache" tag for caching, to address limitations.
See issue "when using --cache=true, kaniko fail to push cache layer [...]":
GoogleContainerTools/kaniko#1459

Does not specify a context since no Dockerfile is using COPY or ADD instructions.

Does not enable reproducible builds as
that results in builds failing with an out of memory error.
See issue "Using --reproducible loads entire image into memory":
GoogleContainerTools/kaniko#862

Previous attempts, for the records:
  - Alex Bennée: https://lore.kernel.org/qemu-devel/[email protected]/
  - Camilla Conte (me): https://lore.kernel.org/qemu-devel/[email protected]/

Signed-off-by: Camilla Conte <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
spotlesstofu authored and Patchew Applier committed May 16, 2024
1 parent 85ef20f commit ff1f9ca
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions .gitlab-ci.d/container-template.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
.container_job_template:
extends: .base_job_template
image: docker:latest
stage: containers
services:
- docker:dind
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DOCKERFILE: "$CI_PROJECT_DIR/tests/docker/dockerfiles/$NAME.docker"
CACHE_REPO: "$CI_REGISTRY/qemu-project/qemu/qemu/$NAME-cache"
before_script:
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:$QEMU_CI_CONTAINER_TAG"
# Always ':latest' because we always use upstream as a common cache source
- export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- until docker info; do sleep 1; done
script:
- echo "TAG:$TAG"
- echo "COMMON_TAG:$COMMON_TAG"
- docker build --tag "$TAG" --cache-from "$TAG" --cache-from "$COMMON_TAG"
--build-arg BUILDKIT_INLINE_CACHE=1
-f "tests/docker/dockerfiles/$NAME.docker" "."
- docker push "$TAG"
after_script:
- docker logout
- /kaniko/executor
--dockerfile "$DOCKERFILE"
--destination "$TAG"
--cache=true
--cache-repo="$CACHE_REPO"

0 comments on commit ff1f9ca

Please sign in to comment.