[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/7] tests/gitlab: use kaniko to build images
From: |
Alex Bennée |
Subject: |
[PATCH 7/7] tests/gitlab: use kaniko to build images |
Date: |
Fri, 24 Feb 2023 18:08:57 +0000 |
Apparently the docker-in-docker approach has some flaws including
needing privileged mode to run and being quite slow. An alternative
approach is to use Google's kaniko tool. It also works across
different gitlab executors.
Following the gitlab example code we drop all the direct docker calls
and usage of the script and make a direct call to kaniko and hope the
images are cacheable by others.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
.gitlab-ci.d/container-template.yml | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/.gitlab-ci.d/container-template.yml
b/.gitlab-ci.d/container-template.yml
index c434b9c8f3..c2d7950df8 100644
--- a/.gitlab-ci.d/container-template.yml
+++ b/.gitlab-ci.d/container-template.yml
@@ -1,22 +1,17 @@
.container_job_template:
extends: .base_job_template
- image: docker:stable
+ image:
+ name: gcr.io/kaniko-project/executor:v1.9.0-debug
+ entrypoint: [""]
stage: containers
- services:
- - docker:dind
before_script:
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
- - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/$NAME:latest"
- - apk add python3
- - docker info
- - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p
"$CI_REGISTRY_PASSWORD"
+ - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
script:
- echo "TAG:$TAG"
- echo "COMMON_TAG:$COMMON_TAG"
- - ./tests/docker/docker.py --engine docker build
- -t "qemu/$NAME" -f "tests/docker/dockerfiles/$NAME.docker"
- -r $CI_REGISTRY/qemu-project/qemu
- - docker tag "qemu/$NAME" "$TAG"
- - docker push "$TAG"
- after_script:
- - docker logout
+ - /kaniko/executor
+ --reproducible
+ --context "${CI_PROJECT_DIR}"
+ --dockerfile
"${CI_PROJECT_DIR}/tests/docker/dockerfiles/$NAME.docker"
+ --destination "${TAG}"
--
2.39.1
- [PATCH 0/7] testing/next: docker.py removal and kaniko updates, Alex Bennée, 2023/02/24
- [PATCH 1/7] configure: expose the direct container command, Alex Bennée, 2023/02/24
- [PATCH 2/7] tests/dockerfiles: unify debian-toolchain references, Alex Bennée, 2023/02/24
- [PATCH 7/7] tests/gitlab: use kaniko to build images,
Alex Bennée <=
- [PATCH 6/7] tests/docker: use direct RUNC call to run test jobs, Alex Bennée, 2023/02/24
- [PATCH 3/7] tests/lcitool: append user setting stanza to dockerfiles, Alex Bennée, 2023/02/24
- [PATCH 4/7] tests/docker: add USER stanzas to non-lci images, Alex Bennée, 2023/02/24