[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gitlab-ci: Replace Docker with Kaniko
From: |
Camilla Conte |
Subject: |
[PATCH] gitlab-ci: Replace Docker with Kaniko |
Date: |
Thu, 16 May 2024 17:52:43 +0100 |
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 [...]":
https://github.com/GoogleContainerTools/kaniko/issues/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":
https://github.com/GoogleContainerTools/kaniko/issues/862
Previous attempts, for the records:
- Alex Bennée:
https://lore.kernel.org/qemu-devel/20230330101141.30199-12-alex.bennee@linaro.org/
- Camilla Conte (me):
https://lore.kernel.org/qemu-devel/20230531150824.32349-6-cconte@redhat.com/
Signed-off-by: Camilla Conte <cconte@redhat.com>
---
.gitlab-ci.d/container-template.yml | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/.gitlab-ci.d/container-template.yml
b/.gitlab-ci.d/container-template.yml
index 4eec72f383..066f253dd5 100644
--- a/.gitlab-ci.d/container-template.yml
+++ b/.gitlab-ci.d/container-template.yml
@@ -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"
--
2.45.0
- [PATCH] gitlab-ci: Replace Docker with Kaniko,
Camilla Conte <=