gitlab: convert build/container jobs to .base_job_template

This converts the main build and container jobs to use the
base job rules, defining the following new variables

 - QEMU_JOB_SKIPPED - jobs that are known to be currently
   broken and should not be run. Can still be manually
   launched if desired.

 - QEMU_JOB_AVOCADO - jobs that run the Avocado integration
   test harness.

 - QEMU_JOB_PUBLISH - jobs that publish content after the
   branch is merged upstream

As build-tools-and-docs runs on master we declare the requirement of
building amd64-debian-container optional as it should already exits
once we merge.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220526110705.59952-5-berrange@redhat.com>
[AJB: fix upstream typo, mention optional container req]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220527153603.887929-32-alex.bennee@linaro.org>
This commit is contained in:
Daniel P. Berrangé 2022-05-27 16:36:01 +01:00 committed by Alex Bennée
parent 16fee101d9
commit e312d1fdbb
8 changed files with 65 additions and 31 deletions

View File

@ -16,10 +16,22 @@
- if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == "" || $CIRRUS_API_TOKEN == "")' - if: '$QEMU_JOB_CIRRUS && ($CIRRUS_GITHUB_REPO == "" || $CIRRUS_API_TOKEN == "")'
when: never when: never
# Publishing jobs should only run on the default branch in upstream
- if: '$QEMU_JOB_PUBLISH == "1" && $CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
when: never
# Non-publishing jobs should only run on staging branches in upstream
- if: '$QEMU_JOB_PUBLISH != "1" && $CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH !~ /staging/'
when: never
# Jobs only intended for forks should always be skipped on upstream # Jobs only intended for forks should always be skipped on upstream
- if: '$QEMU_JOB_ONLY_FORKS == "1" && $CI_PROJECT_NAMESPACE == "qemu-project"' - if: '$QEMU_JOB_ONLY_FORKS == "1" && $CI_PROJECT_NAMESPACE == "qemu-project"'
when: never when: never
# Avocado jobs don't run in forks unless $QEMU_CI_AVOCADO_TESTING is set
- if: '$QEMU_JOB_AVOCADO && $QEMU_CI_AVOCADO_TESTING != "1" && $CI_PROJECT_NAMESPACE != "qemu-project"'
when: never
############################################################# #############################################################
# Stage 2: fine tune execution of jobs in specific scenarios # Stage 2: fine tune execution of jobs in specific scenarios
@ -31,6 +43,16 @@
when: manual when: manual
allow_failure: true allow_failure: true
# Skipped jobs should not be run unless manually triggered
- if: '$QEMU_JOB_SKIPPED'
when: manual
allow_failure: true
# Avocado jobs can be manually start in forks if $QEMU_CI_AVOCADO_TESTING is unset
- if: '$QEMU_JOB_AVOCADO && $CI_PROJECT_NAMESPACE != "qemu-project"'
when: manual
allow_failure: true
############################################################# #############################################################
# Stage 3: catch all logic applying to any job not matching # Stage 3: catch all logic applying to any job not matching

View File

@ -1,4 +1,5 @@
.native_build_job_template: .native_build_job_template:
extends: .base_job_template
stage: build stage: build
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
before_script: before_script:
@ -27,6 +28,7 @@
fi fi
.common_test_job_template: .common_test_job_template:
extends: .base_job_template
stage: test stage: test
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
script: script:
@ -77,15 +79,5 @@
after_script: after_script:
- cd build - cd build
- du -chs ${CI_PROJECT_DIR}/avocado-cache - du -chs ${CI_PROJECT_DIR}/avocado-cache
rules: variables:
# Only run these jobs if running on the mainstream namespace, QEMU_JOB_AVOCADO: 1
# or if the user set the QEMU_CI_AVOCADO_TESTING variable (either
# in its namespace setting or via git-push option, see documentation
# in /.gitlab-ci.yml of this repository).
- if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
when: on_success
- if: '$QEMU_CI_AVOCADO_TESTING'
when: on_success
# Otherwise, set to manual (the jobs are created but not run).
- when: manual
allow_failure: true

View File

@ -360,12 +360,11 @@ build-cfi-aarch64:
expire_in: 2 days expire_in: 2 days
paths: paths:
- build - build
rules: variables:
# FIXME: This job is often failing, likely due to out-of-memory problems in # FIXME: This job is often failing, likely due to out-of-memory problems in
# the constrained containers of the shared runners. Thus this is marked as # the constrained containers of the shared runners. Thus this is marked as
# manual until the situation has been solved. # skipped until the situation has been solved.
- when: manual QEMU_JOB_SKIPPED: 1
allow_failure: true
check-cfi-aarch64: check-cfi-aarch64:
extends: .native_test_job_template extends: .native_test_job_template
@ -402,12 +401,11 @@ build-cfi-ppc64-s390x:
expire_in: 2 days expire_in: 2 days
paths: paths:
- build - build
rules: variables:
# FIXME: This job is often failing, likely due to out-of-memory problems in # FIXME: This job is often failing, likely due to out-of-memory problems in
# the constrained containers of the shared runners. Thus this is marked as # the constrained containers of the shared runners. Thus this is marked as
# manual until the situation has been solved. # skipped until the situation has been solved.
- when: manual QEMU_JOB_SKIPPED: 1
allow_failure: true
check-cfi-ppc64-s390x: check-cfi-ppc64-s390x:
extends: .native_test_job_template extends: .native_test_job_template
@ -579,6 +577,7 @@ build-without-default-features:
MAKE_CHECK_ARGS: check-unit check-qtest SPEED=slow MAKE_CHECK_ARGS: check-unit check-qtest SPEED=slow
build-libvhost-user: build-libvhost-user:
extends: .base_job_template
stage: build stage: build
image: $CI_REGISTRY_IMAGE/qemu/fedora:latest image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
needs: needs:
@ -595,10 +594,13 @@ build-tools-and-docs-debian:
extends: .native_build_job_template extends: .native_build_job_template
needs: needs:
job: amd64-debian-container job: amd64-debian-container
# when running on 'master' we use pre-existing container
optional: true
variables: variables:
IMAGE: debian-amd64 IMAGE: debian-amd64
MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope
CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
QEMU_JOB_PUBLISH: 1
artifacts: artifacts:
expire_in: 2 days expire_in: 2 days
paths: paths:
@ -618,6 +620,7 @@ build-tools-and-docs-debian:
# that users can see the results of their commits, regardless # that users can see the results of their commits, regardless
# of what topic branch they're currently using # of what topic branch they're currently using
pages: pages:
extends: .base_job_template
image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
stage: test stage: test
needs: needs:
@ -635,10 +638,5 @@ pages:
artifacts: artifacts:
paths: paths:
- public - public
rules: variables:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' QEMU_JOB_PUBLISH: 1
when: on_success
- if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
when: never
- if: '$CI_PROJECT_NAMESPACE != "qemu-project"'
when: on_success

View File

@ -40,15 +40,13 @@ armhf-debian-cross-container:
# We never want to build hexagon in the CI system and by default we # We never want to build hexagon in the CI system and by default we
# always want to refer to the master registry where it lives. # always want to refer to the master registry where it lives.
hexagon-cross-container: hexagon-cross-container:
extends: .base_job_template
image: docker:stable image: docker:stable
stage: containers stage: containers
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
when: never
- when: always
variables: variables:
NAME: debian-hexagon-cross NAME: debian-hexagon-cross
GIT_DEPTH: 1 GIT_DEPTH: 1
QEMU_JOB_ONLY_FORKS: 1
services: services:
- docker:dind - docker:dind
before_script: before_script:

View File

@ -1,4 +1,5 @@
.container_job_template: .container_job_template:
extends: .base_job_template
image: docker:stable image: docker:stable
stage: containers stage: containers
services: services:

View File

@ -1,4 +1,5 @@
.cross_system_build_job: .cross_system_build_job:
extends: .base_job_template
stage: build stage: build
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
timeout: 80m timeout: 80m
@ -24,6 +25,7 @@
# KVM), and set extra options (such disabling other accelerators) via the # KVM), and set extra options (such disabling other accelerators) via the
# $EXTRA_CONFIGURE_OPTS variable. # $EXTRA_CONFIGURE_OPTS variable.
.cross_accel_build_job: .cross_accel_build_job:
extends: .base_job_template
stage: build stage: build
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
timeout: 30m timeout: 30m
@ -36,6 +38,7 @@
- make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
.cross_user_build_job: .cross_user_build_job:
extends: .base_job_template
stage: build stage: build
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
script: script:

View File

@ -1,4 +1,5 @@
.shared_msys2_builder: .shared_msys2_builder:
extends: .base_job_template
tags: tags:
- shared-windows - shared-windows
- windows - windows

View File

@ -73,6 +73,25 @@ The job results are only of interest to contributors prior to
submitting code. They are not required as part of the gating submitting code. They are not required as part of the gating
CI pipeline. CI pipeline.
QEMU_JOB_SKIPPED
~~~~~~~~~~~~~~~~
The job is not reliably successsful in general, so is not
currently suitable to be run by default. Ideally this should
be a temporary marker until the problems can be addressed, or
the job permanently removed.
QEMU_JOB_PUBLISH
~~~~~~~~~~~~~~~~
The job is for publishing content after a branch has been
merged into the upstream default branch.
QEMU_JOB_AVOCADO
~~~~~~~~~~~~~~~~
The job runs the Avocado integration test suite
Contributor controlled runtime variables Contributor controlled runtime variables
---------------------------------------- ----------------------------------------