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>
This commit is contained in:
parent
8053f2eddb
commit
7aff49bb90
1 changed files with 7 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ workflow:
|
|||
|
||||
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 @@ build-container:
|
|||
- 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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue