mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 08:17:53 -06:00
Add CI configuration for Kubernetes
Configure Gitlab CI to run on Kubernetes according to the official documentation. https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#docker-in-docker-with-tls-enabled-in-kubernetes These changes are needed because of the CI jobs using Docker-in-Docker (dind). As soon as Docker-in-Docker is replaced with Kaniko, these changes can be reverted. I documented what I did to set up the Kubernetes runner on the wiki: https://wiki.qemu.org/Testing/CI/KubernetesRunners Signed-off-by: Camilla Conte <cconte@redhat.com> Message-Id: <20230407145252.32955-1-cconte@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
d009607d08
commit
e4da92d994
4 changed files with 26 additions and 8 deletions
|
@ -1,14 +1,14 @@
|
||||||
.container_job_template:
|
.container_job_template:
|
||||||
extends: .base_job_template
|
extends: .base_job_template
|
||||||
image: docker:stable
|
image: docker:20.10.16
|
||||||
stage: containers
|
stage: containers
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:20.10.16-dind
|
||||||
before_script:
|
before_script:
|
||||||
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
|
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
|
||||||
- export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
|
- export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
|
||||||
- apk add python3
|
- apk add python3
|
||||||
- docker info
|
- until docker info; do sleep 1; done
|
||||||
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
||||||
script:
|
script:
|
||||||
- echo "TAG:$TAG"
|
- echo "TAG:$TAG"
|
||||||
|
|
3
.gitlab-ci.d/default.yml
Normal file
3
.gitlab-ci.d/default.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
default:
|
||||||
|
tags:
|
||||||
|
- $RUNNER_TAG
|
|
@ -42,17 +42,15 @@
|
||||||
docker-opensbi:
|
docker-opensbi:
|
||||||
extends: .opensbi_job_rules
|
extends: .opensbi_job_rules
|
||||||
stage: containers
|
stage: containers
|
||||||
image: docker:stable
|
image: docker:20.10.16
|
||||||
services:
|
services:
|
||||||
- docker:stable-dind
|
- docker:20.10.16-dind
|
||||||
variables:
|
variables:
|
||||||
GIT_DEPTH: 3
|
GIT_DEPTH: 3
|
||||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
|
||||||
# We don't use TLS
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
- until docker info; do sleep 1; done
|
||||||
script:
|
script:
|
||||||
- docker pull $IMAGE_TAG || true
|
- docker pull $IMAGE_TAG || true
|
||||||
- docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
# This file contains the set of jobs run by the QEMU project:
|
# This file contains the set of jobs run by the QEMU project:
|
||||||
# https://gitlab.com/qemu-project/qemu/-/pipelines
|
# https://gitlab.com/qemu-project/qemu/-/pipelines
|
||||||
|
|
||||||
|
variables:
|
||||||
|
RUNNER_TAG: ""
|
||||||
|
|
||||||
|
workflow:
|
||||||
|
rules:
|
||||||
|
# Set additional variables when running on Kubernetes.
|
||||||
|
# https://wiki.qemu.org/Testing/CI/KubernetesRunners
|
||||||
|
- if: $RUNNER_TAG == "k8s"
|
||||||
|
variables:
|
||||||
|
DOCKER_HOST: tcp://docker:2376
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
DOCKER_TLS_VERIFY: 1
|
||||||
|
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
||||||
|
# Run the pipeline in other cases.
|
||||||
|
- when: always
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
- local: '/.gitlab-ci.d/default.yml'
|
||||||
- local: '/.gitlab-ci.d/base.yml'
|
- local: '/.gitlab-ci.d/base.yml'
|
||||||
- local: '/.gitlab-ci.d/stages.yml'
|
- local: '/.gitlab-ci.d/stages.yml'
|
||||||
- local: '/.gitlab-ci.d/opensbi.yml'
|
- local: '/.gitlab-ci.d/opensbi.yml'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue