|author||Michel Dänzer <firstname.lastname@example.org>||2018-12-11 11:47:16 +0100|
|committer||Michel Dänzer <email@example.com>||2018-12-11 11:47:16 +0100|
Generate docker image as part of CI pipeline
This removes the dependency on an externally generated docker image, and should make it easier to update the docker image or make other changes related to it. v2: * If the image doesn't exist, try pulling it from the main repo's registry. * Use debian:testing-slim as the base, might result in a slightly smaller image. v3: * Prevent installation of packages which are only recommended, for an even smaller image. * Add recommendation to remove new image from source repository in favour of the main repository's. Acked-by: Alex Deucher <firstname.lastname@example.org> # v2
Diffstat (limited to '.gitlab-ci.yml')
1 files changed, 37 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aac8bb7..d1960fb 100644
@@ -1,8 +1,43 @@
+# IMAGE_TAG is the tag of the docker image used for the build jobs. If the
+# image doesn't exist yet, the docker-image stage generates it.
+# In order to generate a new image, one should generally change the tag.
+# While removing the image from the registry would also work, that's not
+# recommended except for ephemeral images during development: Replacing an
+# image after a significant amount of time might pull in newer versions of
+# gcc/clang or other packages, which might break the build with older commits
+# using the same tag.
+# After merging a change resulting in generating a new image to the main
+# repository, it's recommended to remove the image from the source repository's
+# container registry, so that the image from the main repository's registry
+# will be used there as well.
+ IMAGE_TAG: "debian-testing-20181213"
+ IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
+ IMAGE_MAIN: "registry.freedesktop.org/xorg/driver/$CI_PROJECT_NAME:$IMAGE_TAG"
+ - docker-image
+ stage: docker-image
+ image: docker:stable
+ - docker:dind
+ - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+ - docker pull "$IMAGE_LOCAL" ||
+ ((docker pull "$IMAGE_MAIN" && docker tag "$IMAGE_MAIN" "$IMAGE_LOCAL") ||
+ docker build -t "$IMAGE_LOCAL" .gitlab-ci;
+ docker push "$IMAGE_LOCAL")
# The default build instructions
@@ -44,7 +79,7 @@ xserver-1.14:
- extends: .default_build
+ extends: xserver-1.14