gitlab CI: use the ifnot-exists templates from ci-templates

Let's not duplicate the functionality, use the upstream templates because
they'll actually see improvements over time.

Define two jobs, one that is the ifnot-exists job and one that is the normal
container-build job. The second one only runs on schedules.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-03-06 15:26:14 +10:00
parent 7d2b4b5ffe
commit fc501b78ba
2 changed files with 256 additions and 85 deletions

View file

@ -185,176 +185,328 @@ check-commit:
reports: reports:
junit: results.xml junit: results.xml
.pull_upstream_or_rebuild: .fedora.packages:
before_script: variables:
# log in to the registry FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- IMAGE="$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG" .ubuntu.packages:
variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
- | .debian.packages:
# force rebuild if schedule, reuse otherwise variables:
if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ; FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
then
# pull the latest upstream image if it exists
skopeo copy docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE \
docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
# check if our image is already in the current registry .centos.packages:
skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ; variables:
fi FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
.arch.packages:
variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
.alpine.packages:
variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
# Pulls in the qemu container from upstream or rebuilds it if missing
.fedora:30@qemu-prep: .fedora:30@qemu-prep:
extends: extends:
- .fedora:30 - .fedora:30
- .fdo.qemu-build@fedora - .fedora.packages
- .pull_upstream_or_rebuild - .fdo.qemu-ifnot-exists@fedora
stage: prep stage: prep
tags: tags:
- kvm - kvm
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0 FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
allow_failure: true allow_failure: true
# Always rebuilds the container
.fedora:30@qemu-forced-rebuild:
extends:
- .fedora:30
- .fedora.packages
- .fdo.qemu-ifnot-exists@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
allow_failure: true
only:
- schedules
# Pulls in the qemu container from upstream or rebuilds it if missing
.fedora:31@qemu-prep: .fedora:31@qemu-prep:
extends: extends:
- .fedora:31 - .fedora:31
- .fdo.qemu-build@fedora - .fedora.packages
- .pull_upstream_or_rebuild - .fdo.qemu-ifnot-exists@fedora
stage: prep stage: prep
tags: tags:
- kvm - kvm
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0 FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
allow_failure: true allow_failure: true
# Always rebuilds the container
.fedora:31@qemu-forced-rebuild:
extends:
- .fedora:31
- .fedora.packages
- .fdo.qemu-ifnot-exists@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
allow_failure: true
only:
- schedules
# This is the actual job
fedora:31@qemu-prep: fedora:31@qemu-prep:
extends: .fedora:31@qemu-prep extends: .fedora:31@qemu-prep
fedora:31@qemu-forced-rebuild:
extends: .fedora:31@qemu-forced-rebuild
### fedora 30
# Pulls in the container from upstream or rebuilds it if missing
fedora:30@container-prep: fedora:30@container-prep:
extends: extends:
- .fedora:30 - .fedora:30
- .fdo.container-build@fedora - .fedora.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@fedora
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
# Always rebuilds the container
fedora:30@container-forced-rebuild:
extends:
- .fedora:30
- .fedora.packages
- .fdo.container-build@fedora
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### fedora 31 # Pulls in the container from upstream or rebuilds it if missing
fedora:31@container-prep: fedora:31@container-prep:
extends: extends:
- .fedora:31 - .fedora:31
- .fdo.container-build@fedora - .fedora.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@fedora
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
# Always rebuilds the container
fedora:31@container-forced-rebuild:
extends:
- .fedora:31
- .fedora.packages
- .fdo.container-build@fedora
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### ubuntu 19.10 # Pulls in the container from upstream or rebuilds it if missing
ubuntu:19.10@container-prep: ubuntu:19.10@container-prep:
extends: extends:
- .ubuntu:19.10 - .ubuntu:19.10
- .fdo.container-build@ubuntu - .ubuntu.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@ubuntu
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
# Always rebuilds the container
ubuntu:19.10@container-forced-rebuild:
extends:
- .ubuntu:19.10
- .ubuntu.packages
- .fdo.container-build@ubuntu
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### ubuntu 19.04 # Pulls in the container from upstream or rebuilds it if missing
ubuntu:19.04@container-prep: ubuntu:19.04@container-prep:
extends: extends:
- .ubuntu:19.04 - .ubuntu:19.04
- .fdo.container-build@ubuntu - .ubuntu.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@ubuntu
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
# Always rebuilds the container
ubuntu:19.04@container-forced-rebuild:
extends:
- .ubuntu:19.04
- .ubuntu.packages
- .fdo.container-build@ubuntu
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### debian stable # Pulls in the container from upstream or rebuilds it if missing
debian:stable@container-prep: debian:stable@container-prep:
extends: extends:
- .debian:stable - .debian:stable
- .fdo.container-build@debian - .debian.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@debian
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
# Always rebuilds the container
debian:stable@container-forced-rebuild:
extends:
- .debian:stable
- .debian.packages
- .fdo.container-build@debian
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### debian sid # Pulls in the container from upstream or rebuilds it if missing
debian:sid@container-prep: debian:sid@container-prep:
extends: extends:
- .debian:sid - .debian:sid
- .fdo.container-build@debian - .debian.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@debian
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
# Always rebuilds the container
debian:sid@container-forced-rebuild:
extends:
- .debian:sid
- .debian.packages
- .fdo.container-build@debian
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### centos 7 # Pulls in the container from upstream or rebuilds it if missing
centos:7@container-prep: centos:7@container-prep:
extends: extends:
- .centos:7 - .centos:7
- .fdo.container-build@centos - .centos.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@centos
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
# Always rebuilds the container
centos:7@container-forced-rebuild:
extends:
- .centos:7
- .centos.packages
- .fdo.container-build@centos
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### centos 8 # Pulls in the container from upstream or rebuilds it if missing
centos:8@container-prep: centos:8@container-prep:
extends: extends:
- .centos:8 - .centos:8
- .fdo.container-build@centos - .centos.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@centos
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
# Always rebuilds the container
centos:8@container-forced-rebuild:
extends:
- .centos:8
- .centos.packages
- .fdo.container-build@centos
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### arch rolling # Pulls in the container from upstream or rebuilds it if missing
arch:rolling@container-prep: arch:rolling@container-prep:
extends: extends:
- .arch:rolling - .arch:rolling
- .fdo.container-build@arch - .arch.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@arch
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
# Always rebuilds the container
arch:rolling@container-forced-rebuild:
extends:
- .arch:rolling
- .arch.packages
- .fdo.container-build@arch
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
### alpine latest # Pulls in the container from upstream or rebuilds it if missing
alpine:latest@container-prep: alpine:latest@container-prep:
extends: extends:
- .alpine:latest - .alpine:latest
- .fdo.container-build@alpine - .alpine.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@alpine
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
# Always rebuilds the container
alpine:latest@container-forced-rebuild:
extends:
- .alpine:latest
- .alpine.packages
- .fdo.container-build@alpine
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
################################################################# #################################################################

View file

@ -122,62 +122,81 @@ check-commit:
reports: reports:
junit: results.xml junit: results.xml
.pull_upstream_or_rebuild: {% for distro in distributions %}
before_script: .{{ distro.name }}.packages:
# log in to the registry variables:
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}'
- IMAGE="$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG" {% endfor %}
- |
# force rebuild if schedule, reuse otherwise
if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
then
# pull the latest upstream image if it exists
skopeo copy docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE \
docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
# check if our image is already in the current registry
skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
fi
{% for distro in distributions %} {% for distro in distributions %}
{% if distro.want_qemu %} {% if distro.want_qemu %}
{% for version in distro.versions %} {% for version in distro.versions %}
# Pulls in the qemu container from upstream or rebuilds it if missing
.{{ distro.name }}:{{ version }}@qemu-prep: .{{ distro.name }}:{{ version }}@qemu-prep:
extends: extends:
- .{{ distro.name }}:{{ version }} - .{{ distro.name }}:{{ version }}
- .fdo.qemu-build@fedora - .{{ distro.name}}.packages
- .pull_upstream_or_rebuild - .fdo.qemu-ifnot-exists@fedora
stage: prep stage: prep
tags: tags:
- kvm - kvm
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }} FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }}
FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}'
allow_failure: true allow_failure: true
# Always rebuilds the container
.{{ distro.name }}:{{ version }}@qemu-forced-rebuild:
extends:
- .{{ distro.name }}:{{ version }}
- .{{ distro.name}}.packages
- .fdo.qemu-ifnot-exists@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }}
allow_failure: true
only:
- schedules
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
# This is the actual job
fedora:31@qemu-prep: fedora:31@qemu-prep:
extends: .fedora:31@qemu-prep extends: .fedora:31@qemu-prep
fedora:31@qemu-forced-rebuild:
extends: .fedora:31@qemu-forced-rebuild
{% for distro in distributions %} {% for distro in distributions %}
{% for version in distro.versions %} {% for version in distro.versions %}
### {{ distro.name }} {{ version }} # Pulls in the container from upstream or rebuilds it if missing
{{ distro.name }}:{{ version }}@container-prep: {{ distro.name }}:{{ version }}@container-prep:
extends: extends:
- .{{ distro.name }}:{{ version }} - .{{ distro.name }}:{{ version }}
- .fdo.container-build@{{ distro.name }} - .{{ distro.name}}.packages
- .pull_upstream_or_rebuild - .fdo.container-ifnot-exists@{{ distro.name }}
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}'
# Always rebuilds the container
{{ distro.name }}:{{ version }}@container-forced-rebuild:
extends:
- .{{ distro.name }}:{{ version }}
- .{{ distro.name}}.packages
- .fdo.container-build@{{ distro.name }}
stage: prep
only:
- schedules
variables:
GIT_STRATEGY: none
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}