1
0
Fork 0
android_external_drm_hwcomp.../.gitlab-ci.yml
Mattijs Korpershoek 7aff49bb90 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>
2024-10-11 17:08:43 +02:00

74 lines
1.7 KiB
YAML

workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push'
variables:
DEBIAN_FRONTEND: noninteractive
DOCKER_IMAGE_TAG: registry.freedesktop.org/drm-hwcomposer/drm-hwcomposer:latest
stages:
- build-container
- build
- tidy
- style
build-container:
stage: build-container
image: docker:27.0.3
services:
- 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:
- .ci/Dockerfile
- if: $CI_PIPELINE_SOURCE == 'push'
changes:
- .ci/Dockerfile
build:
stage: build
image: $DOCKER_IMAGE_TAG
script:
- mkdir -p install/arm64
- rm ${HOME}/aospless/src
- ln -s ${PWD} ${HOME}/aospless/src
- make -C ${HOME}/aospless all
- cp -r ${HOME}/aospless/install/* install/arm64
artifacts:
paths:
- install/
expire_in: 1 week
tidy:
stage: tidy
image: $DOCKER_IMAGE_TAG
script:
- rm ${HOME}/aospless/src
- ln -s ${PWD} ${HOME}/aospless/src
- BASE_DIR=${HOME}/aospless make -j$(nproc) -k -f .ci/Makefile
timeout: 2h
checkstyle:
stage: style
image: $DOCKER_IMAGE_TAG
script: "./.ci/.gitlab-ci-checkcommit.sh"
artifacts:
when: on_failure
untracked: true