drm_hwcomposer: CI: Use upstream container image conditionally
Right now we use $CI_REGISTRY_IMAGE:latest as the docker image for
running build, tidy and checkstyle.
The problem with this is that CI_REGISTRY_IMAGE points to the *fork*'s
container registry.
For example, if the ddavenport user has this fork:
https://gitlab.freedesktop.org/ddavenport/drm-hwcomposer
Then CI_REGISTRY_IMAGE will be:
registry.freedesktop.org/ddavenport/drm-hwcomposer
This won't work for forks that never build the container image.
Use registry.freedesktop.org/drm-hwcomposer/drm-hwcomposer:latest as
container image by default.
For MRs that modify .ci/Dockerfile, a container will be rebuild
and the forks image will be used instead.
Link: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/97
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ea15c9a..5863159 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,7 @@
variables:
DEBIAN_FRONTEND: noninteractive
- DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
+ DOCKER_IMAGE_TAG: registry.freedesktop.org/drm-hwcomposer/drm-hwcomposer:latest
stages:
- build-container
@@ -20,13 +20,19 @@
- docker:27.0.3-dind
variables:
DOCKER_TLS_CERTDIR: ""
+ # Use the fork's docker image when rebuilding the container
+ DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
before_script:
- echo "$CI_JOB_TOKEN" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
script:
- docker build -t $DOCKER_IMAGE_TAG -f .ci/Dockerfile .
- docker push $DOCKER_IMAGE_TAG
+ - echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> build.env
after_script:
- docker logout
+ artifacts:
+ reports:
+ dotenv: build.env
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes: