From 6441b639aaaf311c08f672f8af86ff7f2fa9b4d5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 24 Feb 2020 08:12:35 +1000 Subject: [PATCH] gitlab CI: update to the distribution-independent CI-templates These templates get rid of the various distribution-specific naming and instead default to the namespaced FDO_DISTRIBUTION_ for whatever value we need. So FEDORA_RPMS, DEBIAN_DEBS etc. becomes FDO_DISTRIBUTION_PACKAGES for example. By necessity this is one large commit. gitlab does not allow nested variable expansion, so the previous approach of global variables didn't work. Specifically, we'd end up with a template in this form: variables: FEDORA_TAG: 12345 .base_template: variables: DISTRO_IMAGE: $DISTRO_TAG .fedora: variables: $DISTRO_TAG: $FEDORA_TAG But the actual DISTRO_IMAGE variable would be the literal string $FEDORA_TAG, not the value of that variable. So all of it needed to be reworked. Specifically: - the packages to install moved to the config yaml file - the distribution tag is now in the config yaml file - all distributions now share the same tag (because lazyness) - there are .fedora:30, .debian:stable, etc. templates now with the variables defined as needed, jobs will extends those templates as they need those distributions - qemu-prep jobs are now generated too (based on the config yaml file) Overall, it ends up cleaner despite the mess in this patch. Signed-off-by: Peter Hutterer --- .gitlab-ci.yml | 478 ++++++++++++++++--------------- .gitlab-ci/gitlab-ci-config.yaml | 105 +++++++ .gitlab-ci/gitlab-ci.tmpl | 178 ++++++------ 3 files changed, 431 insertions(+), 330 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa8457f..f15d58c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ # # ######################################## -.templates_sha: &template_sha 8410d3382c4ba5e83da76a027cb332169f2a95ad # see https://docs.gitlab.com/ee/ci/yaml/#includefile +.templates_sha: &template_sha df52af2195b052325daf5d715c88be90f8ec7d86 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: # Alpine container builder template @@ -42,42 +42,10 @@ stages: - container_clean # clean up unused container images variables: - ############################################################################### - # This is the list of packages required to build libevdev with the default # - # configuration. # - # # - # Run dnf install/apt-get install/.. with the list of packages for your # - # distribution # - ############################################################################### - FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer' - CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz' - UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' - DEBIAN_DEBS: $UBUNTU_DEBS - ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen' - ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers' - ############################ end of package lists ############################# - # these tags should be updated each time the list of packages is updated - # changing these will force rebuilding the associated image - # Note: these tags have no meaning and are not tied to a particular - # libevdev version - FEDORA_TAG: '2020-02-26.4' - CENTOS_TAG: '2020-02-26.4' - DEBIAN_TAG: '2020-02-26.4' - UBUNTU_TAG: '2020-02-26.4' - ARCH_TAG: '2020-02-26.4' - ALPINE_TAG: '2020-02-26.4' - QEMU_TAG: 'qemu-2020-02-26.4' - - UPSTREAM_REPO: libevdev/libevdev + # The upstrem repository we will check for images + FDO_UPSTREAM_REPO: libevdev/libevdev + # The image that has buildah installed BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest - FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG - CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG - UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG - DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG - ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/rolling:$ARCH_TAG - ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG - QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG - LIBEVDEV_SKIP_ROOT_TESTS: 1 GIT_DEPTH: 1 MESON_BUILDDIR: 'build dir' @@ -110,6 +78,86 @@ variables: script: - .gitlab-ci/meson-build.sh +# Base image for a given distribution, provides +# - the image of that distribution +# - DISTRO_CONTAINER_IMAGE for any manipulation the job needs to be +.distribution_image: + image: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG + variables: + DISTRO_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG + +.fedora:30: + extends: .distribution_image + variables: + DISTRIB_NAME: 'fedora' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '30' + +.fedora:31: + extends: .distribution_image + variables: + DISTRIB_NAME: 'fedora' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '31' + +.ubuntu:19.10: + extends: .distribution_image + variables: + DISTRIB_NAME: 'ubuntu' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '19.10' + +.ubuntu:19.04: + extends: .distribution_image + variables: + DISTRIB_NAME: 'ubuntu' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '19.04' + +.debian:stable: + extends: .distribution_image + variables: + DISTRIB_NAME: 'debian' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: 'stable' + +.debian:sid: + extends: .distribution_image + variables: + DISTRIB_NAME: 'debian' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: 'sid' + +.centos:7: + extends: .distribution_image + variables: + DISTRIB_NAME: 'centos' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '7' + +.centos:8: + extends: .distribution_image + variables: + DISTRIB_NAME: 'centos' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: '8' + +.arch:rolling: + extends: .distribution_image + variables: + DISTRIB_NAME: 'arch' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: 'rolling' + +.alpine:latest: + extends: .distribution_image + variables: + DISTRIB_NAME: 'alpine' + FDO_DISTRIBUTION_TAG: '2020-03-06.0' + FDO_DISTRIBUTION_VERSION: 'latest' + + + ################################################################# # # # prep stage # @@ -162,176 +210,172 @@ check-commit: # log in to the registry - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - # get the full container image name (DISTRIB_VERSION still has indirections) - - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG") + # get the full container image name (FDO_DISTRIBUTION_VERSION still has indirections) + - IMAGE=$(eval echo "$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG") - | # 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/$UPSTREAM_REPO/$IMAGE \ + 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 -fedora:31@qemu-prep: +.fedora:30@qemu-prep: extends: - - .fedora@qemu-build + - .fedora:30 + - .fdo.qemu-build@fedora - .pull_upstream_or_rebuild stage: prep tags: - kvm variables: GIT_STRATEGY: none - FEDORA_VERSION: 31 - FEDORA_TAG: $QEMU_TAG - DISTRIB_NAME: fedora - DISTRIB_VERSION: $FEDORA_VERSION - TAG: $QEMU_TAG + 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 +.fedora:31@qemu-prep: + extends: + - .fedora:31 + - .fdo.qemu-build@fedora + - .pull_upstream_or_rebuild + stage: prep + tags: + - kvm + variables: + GIT_STRATEGY: none + 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 + + +fedora:31@qemu-prep: + extends: .fedora:31@qemu-prep + ### fedora 30 fedora:30@container-prep: extends: - - .fedora@container-build + - .fedora:30 + - .fdo.container-build@fedora - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - FEDORA_VERSION: '30' - DISTRIB_NAME: fedora - DISTRIB_VERSION: $FEDORA_VERSION - TAG: $FEDORA_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer' ### fedora 31 fedora:31@container-prep: extends: - - .fedora@container-build + - .fedora:31 + - .fdo.container-build@fedora - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - FEDORA_VERSION: '31' - DISTRIB_NAME: fedora - DISTRIB_VERSION: $FEDORA_VERSION - TAG: $FEDORA_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer' ### ubuntu 19.10 ubuntu:19.10@container-prep: extends: - - .ubuntu@container-build + - .ubuntu:19.10 + - .fdo.container-build@ubuntu - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - UBUNTU_VERSION: '19.10' - DISTRIB_NAME: ubuntu - DISTRIB_VERSION: $UBUNTU_VERSION - TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' ### ubuntu 19.04 ubuntu:19.04@container-prep: extends: - - .ubuntu@container-build + - .ubuntu:19.04 + - .fdo.container-build@ubuntu - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - UBUNTU_VERSION: '19.04' - DISTRIB_NAME: ubuntu - DISTRIB_VERSION: $UBUNTU_VERSION - TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' ### debian stable debian:stable@container-prep: extends: - - .debian@container-build + - .debian:stable + - .fdo.container-build@debian - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - DEBIAN_VERSION: 'stable' - DISTRIB_NAME: debian - DISTRIB_VERSION: $DEBIAN_VERSION - TAG: $DEBIAN_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' ### debian sid debian:sid@container-prep: extends: - - .debian@container-build + - .debian:sid + - .fdo.container-build@debian - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - DEBIAN_VERSION: 'sid' - DISTRIB_NAME: debian - DISTRIB_VERSION: $DEBIAN_VERSION - TAG: $DEBIAN_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' ### centos 7 centos:7@container-prep: extends: - - .centos@container-build + - .centos:7 + - .fdo.container-build@centos - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - CENTOS_VERSION: '7' - DISTRIB_NAME: centos - DISTRIB_VERSION: $CENTOS_VERSION - TAG: $CENTOS_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz' ### centos 8 centos:8@container-prep: extends: - - .centos@container-build + - .centos:8 + - .fdo.container-build@centos - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - CENTOS_VERSION: '8' - DISTRIB_NAME: centos - DISTRIB_VERSION: $CENTOS_VERSION - TAG: $CENTOS_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz' ### arch rolling arch:rolling@container-prep: extends: - - .arch@container-build + - .arch:rolling + - .fdo.container-build@arch - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - ARCH_VERSION: 'rolling' - DISTRIB_NAME: arch - DISTRIB_VERSION: $ARCH_VERSION - TAG: $ARCH_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen' ### alpine latest alpine:latest@container-prep: extends: - - .alpine@container-build + - .alpine:latest + - .fdo.container-build@alpine - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - ALPINE_VERSION: 'latest' - DISTRIB_NAME: alpine - DISTRIB_VERSION: $ALPINE_VERSION - TAG: $ALPINE_TAG + FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers' ################################################################# @@ -350,8 +394,7 @@ alpine:latest@container-prep: stage: container_clean image: $BUILDAH_IMAGE script: - # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections) - - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE") + - CONTAINER_IMAGE=$DISTRO_CONTAINER_IMAGE - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/) - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:) - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:) @@ -416,85 +459,65 @@ alpine:latest@container-prep: variables: GIT_STRATEGY: none - ### fedora 30 fedora:30@container-clean: - extends: .container-clean - variables: - FEDORA_VERSION: '30' - CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE - + extends: + - .fedora:30 + - .container-clean ### fedora 31 fedora:31@container-clean: - extends: .container-clean - variables: - FEDORA_VERSION: '31' - CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE - + extends: + - .fedora:31 + - .container-clean ### ubuntu 19.10 ubuntu:19.10@container-clean: - extends: .container-clean - variables: - UBUNTU_VERSION: '19.10' - CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE - + extends: + - .ubuntu:19.10 + - .container-clean ### ubuntu 19.04 ubuntu:19.04@container-clean: - extends: .container-clean - variables: - UBUNTU_VERSION: '19.04' - CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE - + extends: + - .ubuntu:19.04 + - .container-clean ### debian stable debian:stable@container-clean: - extends: .container-clean - variables: - DEBIAN_VERSION: 'stable' - CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE - + extends: + - .debian:stable + - .container-clean ### debian sid debian:sid@container-clean: - extends: .container-clean - variables: - DEBIAN_VERSION: 'sid' - CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE - + extends: + - .debian:sid + - .container-clean ### centos 7 centos:7@container-clean: - extends: .container-clean - variables: - CENTOS_VERSION: '7' - CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE - + extends: + - .centos:7 + - .container-clean ### centos 8 centos:8@container-clean: - extends: .container-clean - variables: - CENTOS_VERSION: '8' - CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE - + extends: + - .centos:8 + - .container-clean ### arch rolling arch:rolling@container-clean: - extends: .container-clean - variables: - ARCH_VERSION: 'rolling' - CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE - + extends: + - .arch:rolling + - .container-clean ### alpine latest alpine:latest@container-clean: - extends: .container-clean - variables: - ALPINE_VERSION: 'latest' - CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE + extends: + - .alpine:latest + - .container-clean ################################################################# @@ -521,160 +544,144 @@ alpine:latest@container-clean: fedora:30@autotools-build: - extends: .autotools-build@template + extends: + - .fedora:30 + - .autotools-build@template stage: autotools - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: '30' needs: ['fedora:30@container-prep'] fedora:30@meson-build: - extends: .meson-build@template + extends: + - .fedora:30 + - .meson-build@template stage: meson - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: '30' needs: ['fedora:30@container-prep'] fedora:31@autotools-build: - extends: .autotools-build@template + extends: + - .fedora:31 + - .autotools-build@template stage: autotools - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: '31' needs: ['fedora:31@container-prep'] fedora:31@meson-build: - extends: .meson-build@template + extends: + - .fedora:31 + - .meson-build@template stage: meson - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: '31' needs: ['fedora:31@container-prep'] ubuntu:19.10@autotools-build: - extends: .autotools-build@template + extends: + - .ubuntu:19.10 + - .autotools-build@template stage: autotools - image: $UBUNTU_CONTAINER_IMAGE - variables: - UBUNTU_VERSION: '19.10' needs: ['ubuntu:19.10@container-prep'] ubuntu:19.10@meson-build: - extends: .meson-build@template + extends: + - .ubuntu:19.10 + - .meson-build@template stage: meson - image: $UBUNTU_CONTAINER_IMAGE - variables: - UBUNTU_VERSION: '19.10' needs: ['ubuntu:19.10@container-prep'] ubuntu:19.04@autotools-build: - extends: .autotools-build@template + extends: + - .ubuntu:19.04 + - .autotools-build@template stage: autotools - image: $UBUNTU_CONTAINER_IMAGE - variables: - UBUNTU_VERSION: '19.04' needs: ['ubuntu:19.04@container-prep'] ubuntu:19.04@meson-build: - extends: .meson-build@template + extends: + - .ubuntu:19.04 + - .meson-build@template stage: meson - image: $UBUNTU_CONTAINER_IMAGE - variables: - UBUNTU_VERSION: '19.04' needs: ['ubuntu:19.04@container-prep'] debian:stable@autotools-build: - extends: .autotools-build@template + extends: + - .debian:stable + - .autotools-build@template stage: autotools - image: $DEBIAN_CONTAINER_IMAGE - variables: - DEBIAN_VERSION: 'stable' needs: ['debian:stable@container-prep'] debian:stable@meson-build: - extends: .meson-build@template + extends: + - .debian:stable + - .meson-build@template stage: meson - image: $DEBIAN_CONTAINER_IMAGE - variables: - DEBIAN_VERSION: 'stable' needs: ['debian:stable@container-prep'] debian:sid@autotools-build: - extends: .autotools-build@template + extends: + - .debian:sid + - .autotools-build@template stage: autotools - image: $DEBIAN_CONTAINER_IMAGE - variables: - DEBIAN_VERSION: 'sid' needs: ['debian:sid@container-prep'] debian:sid@meson-build: - extends: .meson-build@template + extends: + - .debian:sid + - .meson-build@template stage: meson - image: $DEBIAN_CONTAINER_IMAGE - variables: - DEBIAN_VERSION: 'sid' needs: ['debian:sid@container-prep'] centos:7@autotools-build: - extends: .autotools-build@template + extends: + - .centos:7 + - .autotools-build@template stage: autotools - image: $CENTOS_CONTAINER_IMAGE variables: - CENTOS_VERSION: '7' MAKE_ARGS: '' # disable distcheck, requires doxygen needs: ['centos:7@container-prep'] centos:8@autotools-build: - extends: .autotools-build@template + extends: + - .centos:8 + - .autotools-build@template stage: autotools - image: $CENTOS_CONTAINER_IMAGE variables: - CENTOS_VERSION: '8' MAKE_ARGS: '' # disable distcheck, requires doxygen needs: ['centos:8@container-prep'] arch:rolling@autotools-build: - extends: .autotools-build@template + extends: + - .arch:rolling + - .autotools-build@template stage: autotools - image: $ARCH_CONTAINER_IMAGE - variables: - ARCH_VERSION: 'rolling' needs: ['arch:rolling@container-prep'] arch:rolling@meson-build: - extends: .meson-build@template + extends: + - .arch:rolling + - .meson-build@template stage: meson - image: $ARCH_CONTAINER_IMAGE - variables: - ARCH_VERSION: 'rolling' needs: ['arch:rolling@container-prep'] alpine:latest@autotools-build: - extends: .autotools-build@template + extends: + - .alpine:latest + - .autotools-build@template stage: autotools - image: $ALPINE_CONTAINER_IMAGE - variables: - ALPINE_VERSION: 'latest' needs: ['alpine:latest@container-prep'] alpine:latest@meson-build: - extends: .meson-build@template + extends: + - .alpine:latest + - .meson-build@template stage: meson - image: $ALPINE_CONTAINER_IMAGE - variables: - ALPINE_VERSION: 'latest' needs: ['alpine:latest@container-prep'] @@ -683,11 +690,10 @@ alpine:latest@meson-build: # We only run the build option combinations on one image # because they're supposed to fail equally on all .fedora-custom-build@autotools-template: - extends: .autotools-build@template + extends: + - .fedora:31 + - .autotools-build@template stage: build - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] no-valgrind:autotools: @@ -726,11 +732,10 @@ enable-gcov:autotools: CONFIGURE_FLAGS: "--enable-gcov" .fedora-custom-build@meson-template: - extends: .meson-build@template + extends: + - .fedora:31 + - .meson-build@template stage: build - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] no-valgrind:meson: @@ -777,8 +782,9 @@ scan-build:meson: SKIP_MESON_TEST: 1 soname: + extends: + - .fedora:31 stage: build - image: $FEDORA_CONTAINER_IMAGE script: - ./autogen.sh --prefix=$PWD/prefix-autotools/ - make install @@ -786,8 +792,6 @@ soname: - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/ - ninja -C "$MESON_BUILDDIR" install - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0 - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] ################################################################# @@ -805,12 +809,14 @@ soname: fi .qemu@fedora:31: + extends: + - .fedora:31 stage: VM - image: $QEMU_CONTAINER_IMAGE + image: + $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG tags: - kvm variables: - FEDORA_VERSION: 31 MESON_BUILDDIR: build_dir script: # start our vm, no args required @@ -863,8 +869,9 @@ qemu:meson:valgrind: MESON_TEST_ARGS: '--setup=valgrind' meson-from-tarball: + extends: + - .fedora:31 stage: tarballs - image: $FEDORA_CONTAINER_IMAGE script: - export INSTALLDIR="$PWD/_inst" - mkdir _build @@ -881,13 +888,12 @@ meson-from-tarball: - ninja -C "$MESON_BUILDDIR" install - popd > /dev/null - ls -lR $INSTALLDIR - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] autotools-from-tarball: + extends: + - .fedora:31 stage: tarballs - image: $FEDORA_CONTAINER_IMAGE script: - export INSTALLDIR="$PWD/_inst" - meson "$MESON_BUILDDIR" @@ -904,6 +910,4 @@ autotools-from-tarball: - popd > /dev/null - popd > /dev/null - ls -lR $INSTALLDIR - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] \ No newline at end of file diff --git a/.gitlab-ci/gitlab-ci-config.yaml b/.gitlab-ci/gitlab-ci-config.yaml index 2e460b9..e2e1d28 100644 --- a/.gitlab-ci/gitlab-ci-config.yaml +++ b/.gitlab-ci/gitlab-ci-config.yaml @@ -1,31 +1,136 @@ # This file contains the configuration for the gitlab ci. # See the .gitlab-ci/generate-gitlab-ci.py file for more info +# + +# We're happy to rebuild all containers when one changes. +.default_tag: &default_tag '2020-03-06.0' distributions: - name: fedora + tag: *default_tag versions: - '30' - '31' + packages: + - git + - gcc + - gcc-c++ + - meson + - automake + - autoconf + - libtool + - make + - pkgconfig + - python3 + - check-devel + - valgrind + - binutils + - doxygen + - xz + - clang-analyzer + want_qemu: true - name: ubuntu + tag: *default_tag versions: - '19.10' - '19.04' + packages: + - git + - gcc + - g++ + - meson + - automake + - autoconf + - libtool + - make + - pkg-config + - python3 + - check + - valgrind + - binutils + - doxygen + - xz-utils - name: debian + tag: *default_tag versions: - 'stable' - 'sid' + packages: + - git + - gcc + - g++ + - meson + - automake + - autoconf + - libtool + - make + - pkg-config + - python3 + - check + - valgrind + - binutils + - doxygen + - xz-utils - name: centos + tag: *default_tag versions: - '7' - '8' + packages: + - git + - gcc + - gcc-c++ + - automake + - autoconf + - libtool + - make + - pkgconfig + - python3 + - check-devel + - valgrind + - binutils + - xz build: meson: False extra_variables: # note: the variable value includes the comment because we want that in the gitlab-ci file MAKE_ARGS: "'' # disable distcheck, requires doxygen" - name: arch + tag: *default_tag versions: - 'rolling' + packages: + - git + - gcc + - meson + - automake + - autoconf + - libtool + - make + - pkgconfig + - python3 + - check + - valgrind + - binutils + - doxygen - name: alpine + tag: *default_tag versions: - 'latest' + packages: + - git + - gcc + - g++ + - meson + - automake + - autoconf + - libtool + - make + - pkgconfig + - python3 + - check-dev + - valgrind + - binutils + - doxygen + - xz + - linux-headers diff --git a/.gitlab-ci/gitlab-ci.tmpl b/.gitlab-ci/gitlab-ci.tmpl index 290f981..7bb170a 100644 --- a/.gitlab-ci/gitlab-ci.tmpl +++ b/.gitlab-ci/gitlab-ci.tmpl @@ -6,7 +6,7 @@ # # ######################################## -.templates_sha: &template_sha 8410d3382c4ba5e83da76a027cb332169f2a95ad # see https://docs.gitlab.com/ee/ci/yaml/#includefile +.templates_sha: &template_sha df52af2195b052325daf5d715c88be90f8ec7d86 # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: {% for distribution in distributions|map(attribute='name')|unique()|sort() %} @@ -26,42 +26,10 @@ stages: - container_clean # clean up unused container images variables: - ############################################################################### - # This is the list of packages required to build libevdev with the default # - # configuration. # - # # - # Run dnf install/apt-get install/.. with the list of packages for your # - # distribution # - ############################################################################### - FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer' - CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz' - UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' - DEBIAN_DEBS: $UBUNTU_DEBS - ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen' - ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers' - ############################ end of package lists ############################# - # these tags should be updated each time the list of packages is updated - # changing these will force rebuilding the associated image - # Note: these tags have no meaning and are not tied to a particular - # libevdev version - FEDORA_TAG: '2020-02-26.4' - CENTOS_TAG: '2020-02-26.4' - DEBIAN_TAG: '2020-02-26.4' - UBUNTU_TAG: '2020-02-26.4' - ARCH_TAG: '2020-02-26.4' - ALPINE_TAG: '2020-02-26.4' - QEMU_TAG: 'qemu-2020-02-26.4' - - UPSTREAM_REPO: libevdev/libevdev + # The upstrem repository we will check for images + FDO_UPSTREAM_REPO: libevdev/libevdev + # The image that has buildah installed BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest - FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG - CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG - UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG - DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG - ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/rolling:$ARCH_TAG - ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG - QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG - LIBEVDEV_SKIP_ROOT_TESTS: 1 GIT_DEPTH: 1 MESON_BUILDDIR: 'build dir' @@ -94,6 +62,30 @@ variables: script: - .gitlab-ci/meson-build.sh +# Base image for a given distribution, provides +# - the image of that distribution +# - DISTRO_CONTAINER_IMAGE for any manipulation the job needs to be +.distribution_image: + image: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG + variables: + DISTRO_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG + +{# Generate templates for every distribution/version combination we want, any + job can then just extends: .name:version and the images will sort + themselves out. #} +{% for distro in distributions %} +{% for version in distro.versions %} +.{{distro.name}}:{{version}}: + extends: .distribution_image + variables: + DISTRIB_NAME: '{{distro.name}}' + FDO_DISTRIBUTION_TAG: '{{distro.tag}}' + FDO_DISTRIBUTION_VERSION: '{{version}}' + +{% endfor %} +{% endfor %} + + ################################################################# # # # prep stage # @@ -146,52 +138,58 @@ check-commit: # log in to the registry - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - # get the full container image name (DISTRIB_VERSION still has indirections) - - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG") + # get the full container image name (FDO_DISTRIBUTION_VERSION still has indirections) + - IMAGE=$(eval echo "$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG") - | # 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/$UPSTREAM_REPO/$IMAGE \ + 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 -fedora:31@qemu-prep: +{% for distro in distributions %} +{% if distro.want_qemu %} +{% for version in distro.versions %} +.{{ distro.name }}:{{ version }}@qemu-prep: extends: - - .fedora@qemu-build + - .{{ distro.name }}:{{ version }} + - .fdo.qemu-build@fedora - .pull_upstream_or_rebuild stage: prep tags: - kvm variables: GIT_STRATEGY: none - FEDORA_VERSION: 31 - FEDORA_TAG: $QEMU_TAG - DISTRIB_NAME: fedora - DISTRIB_VERSION: $FEDORA_VERSION - TAG: $QEMU_TAG + FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }} + FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}' allow_failure: true +{% endfor %} +{% endif %} +{% endfor %} + +fedora:31@qemu-prep: + extends: .fedora:31@qemu-prep + {% for distro in distributions %} {% for version in distro.versions %} ### {{ distro.name }} {{ version }} {{ distro.name }}:{{ version }}@container-prep: extends: - - .{{ distro.name }}@container-build + - .{{ distro.name }}:{{ version }} + - .fdo.container-build@{{ distro.name }} - .pull_upstream_or_rebuild stage: prep variables: GIT_STRATEGY: none - {{ distro.name.upper() }}_VERSION: '{{ version }}' - DISTRIB_NAME: {{ distro.name }} - DISTRIB_VERSION: ${{ distro.name.upper() }}_VERSION - TAG: ${{ distro.name.upper() }}_TAG + FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}' {% endfor %} {% endfor %} @@ -212,8 +210,7 @@ fedora:31@qemu-prep: stage: container_clean image: $BUILDAH_IMAGE script: - # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections) - - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE") + - CONTAINER_IMAGE=$DISTRO_CONTAINER_IMAGE - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/) - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:) - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:) @@ -280,13 +277,11 @@ fedora:31@qemu-prep: {% for distro in distributions %} {% for version in distro.versions %} - ### {{ distro.name }} {{ version }} {{ distro.name }}:{{ version }}@container-clean: - extends: .container-clean - variables: - {{ distro.name.upper() }}_VERSION: '{{ version }}' - CURRENT_CONTAINER_IMAGE: ${{ distro.name.upper() }}_CONTAINER_IMAGE + extends: + - .{{ distro.name }}:{{ version }} + - .container-clean {% endfor %} {% endfor %} @@ -317,32 +312,32 @@ fedora:31@qemu-prep: {% for version in distro.versions %} {{ distro.name }}:{{ version }}@autotools-build: - extends: .autotools-build@template + extends: + - .{{ distro.name }}:{{ version }} + - .autotools-build@template stage: autotools - image: ${{ distro.name.upper() }}_CONTAINER_IMAGE + {# Where we have extra_variables defined, add them to the list #} + {% if distro.build is defined and distro.build.extra_variables is defined %} variables: - {{ distro.name.upper() }}_VERSION: '{{ version }}' - {# Where we have extra_variables defined, add them to the list #} - {% if distro.build is defined and distro.build.extra_variables is defined %} - {% for key, value in distro.build.extra_variables.items() %} + {% for key, value in distro.build.extra_variables.items() %} {{ key }}: {{ value }} - {% endfor %} - {% endif %} + {% endfor %} + {% endif %} needs: ['{{ distro.name }}:{{ version }}@container-prep'] {% if not distro.build is defined or distro.build.meson|default(True) %} {{ distro.name }}:{{ version }}@meson-build: - extends: .meson-build@template + extends: + - .{{ distro.name }}:{{ version }} + - .meson-build@template stage: meson - image: ${{ distro.name.upper() }}_CONTAINER_IMAGE + {# Where we have extra_variables defined, add them to the list #} + {% if distro.build is defined and distro.build.extra_variables is defined %} variables: - {{ distro.name.upper() }}_VERSION: '{{ version }}' - {# Where we have extra_variables defined, add them to the list #} - {% if distro.build is defined and distro.build.extra_variables is defined %} - {% for key, value in distro.build.extra_variables.items() %} + {% for key, value in distro.build.extra_variables.items() %} {{ key }}: {{ value }} - {% endfor %} - {% endif %} + {% endfor %} + {% endif %} needs: ['{{ distro.name }}:{{ version }}@container-prep'] {% endif %} @@ -354,11 +349,10 @@ fedora:31@qemu-prep: # We only run the build option combinations on one image # because they're supposed to fail equally on all .fedora-custom-build@autotools-template: - extends: .autotools-build@template + extends: + - .fedora:31 + - .autotools-build@template stage: build - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] no-valgrind:autotools: @@ -397,11 +391,10 @@ enable-gcov:autotools: CONFIGURE_FLAGS: "--enable-gcov" .fedora-custom-build@meson-template: - extends: .meson-build@template + extends: + - .fedora:31 + - .meson-build@template stage: build - image: $FEDORA_CONTAINER_IMAGE - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] no-valgrind:meson: @@ -448,8 +441,9 @@ scan-build:meson: SKIP_MESON_TEST: 1 soname: + extends: + - .fedora:31 stage: build - image: $FEDORA_CONTAINER_IMAGE script: - ./autogen.sh --prefix=$PWD/prefix-autotools/ - make install @@ -457,8 +451,6 @@ soname: - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/ - ninja -C "$MESON_BUILDDIR" install - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0 - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] ################################################################# @@ -476,12 +468,14 @@ soname: fi .qemu@fedora:31: + extends: + - .fedora:31 stage: VM - image: $QEMU_CONTAINER_IMAGE + image: + $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG tags: - kvm variables: - FEDORA_VERSION: 31 MESON_BUILDDIR: build_dir script: # start our vm, no args required @@ -534,8 +528,9 @@ qemu:meson:valgrind: MESON_TEST_ARGS: '--setup=valgrind' meson-from-tarball: + extends: + - .fedora:31 stage: tarballs - image: $FEDORA_CONTAINER_IMAGE script: - export INSTALLDIR="$PWD/_inst" - mkdir _build @@ -552,13 +547,12 @@ meson-from-tarball: - ninja -C "$MESON_BUILDDIR" install - popd > /dev/null - ls -lR $INSTALLDIR - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] autotools-from-tarball: + extends: + - .fedora:31 stage: tarballs - image: $FEDORA_CONTAINER_IMAGE script: - export INSTALLDIR="$PWD/_inst" - meson "$MESON_BUILDDIR" @@ -575,6 +569,4 @@ autotools-from-tarball: - popd > /dev/null - popd > /dev/null - ls -lR $INSTALLDIR - variables: - FEDORA_VERSION: 31 needs: ['fedora:31@container-prep'] -- 2.34.1