For improved automation, further QA etc.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
phase[12]/key-build*
phase[12]/state.sqlite*
phase[12]/twistd.*
+!.gitlab-ci.yml
+!.gitlab
+!.gitlab/*
+!.gitlab/**/*
--- /dev/null
+variables:
+ BUILDBOT_VERSION: 2.10.1
+
+include:
+ - local: .gitlab/docker.yml
+ - local: .gitlab/docker/buildmaster/gitlab.yml
+ - local: .gitlab/docker/buildslave/gitlab.yml
+
+stages:
+ - docker
+ - docker test
+ - docker deploy
--- /dev/null
+.docker in docker:
+ tags:
+ - gce
+ image: docker:19.03.7
+ services:
+ - docker:19.03.7-dind
+ variables:
+ DOCKER_DRIVER: overlay2
+ DOCKER_TLS_CERTDIR: "/certs"
+
+.build Docker image:
+ stage: docker
+ extends: .docker in docker
+ script:
+ - export IMAGE_NAME="$(echo $CI_JOB_NAME | sed 's/build Docker image \(.*\)/\1/')"
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+ - docker build --build-arg BUILDBOT_VERSION=$BUILDBOT_VERSION -t "$IMAGE_NAME" -f "docker/$IMAGE_NAME/Dockerfile" .
+ - docker tag "$IMAGE_NAME" "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG"
+ - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG"
+
+.deploy Docker image:
+ extends: .docker in docker
+ script:
+ - export IMAGE_NAME="$(echo $CI_JOB_NAME | sed 's/deploy Docker image \(.*\)/\1/')"
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+ - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG"
+
+ - docker tag "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:latest"
+ - docker tag "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:latest" "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_SHORT_SHA"
+ - docker tag "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:latest" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:latest"
+
+ - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:latest"
+ - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_SHORT_SHA"
+ - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:latest"
--- /dev/null
+# Content
+
+This directory contains bits for Docker images used on the GitLab CI.
+
+## buildmaster
+## buildslave
--- /dev/null
+build Docker image buildmaster:
+ stage: docker
+ extends: .build Docker image
+
+test Docker image buildmaster:
+ stage: docker test
+ extends: .docker in docker
+ needs: ["build Docker image buildmaster"]
+ script:
+ - export IMAGE_NAME="$(echo $CI_JOB_NAME | sed 's/test Docker image \(.*\)/\1/')"
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+ - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG"
+ - >
+ docker run --rm "$CI_REGISTRY_IMAGE/$IMAGE_NAME-$BUILDBOT_VERSION:$CI_COMMIT_REF_SLUG" |
+ grep "buildmaster configured in /master"
+
+deploy Docker image buildmaster:
+ stage: docker deploy
+ extends: .deploy Docker image
+ needs: ["test Docker image buildmaster"]
--- /dev/null
+build Docker image buildslave:
+ stage: docker
+ extends: .build Docker image
+
+test Docker image buildslave:
+ stage: docker test
+ extends: .docker in docker
+ needs: ["build Docker image buildslave"]
+ script:
+ - export IMAGE_NAME="$(echo $CI_JOB_NAME | sed 's/test Docker image \(.*\)/\1/')"
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+ - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_REF_SLUG"
+ - >
+ docker run --rm --env BUILDSLAVE_NAME=foo --env BUILDSLAVE_PASSWORD=XXX
+ "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_REF_SLUG" | grep "worker configured in /builder"
+
+deploy Docker image buildslave:
+ stage: docker deploy
+ extends: .deploy Docker image
+ needs: ["test Docker image buildslave"]