[libvirt-sandbox PATCH] gitlab: introduce CI jobs testing git master & distro libvirt

The sandbox build needs to validate one axis - A variety of libvirt versions We test a variety of libvirt versions by running a build against the distro provided libvirt packages. All that is then missing is a build against the latest libvirt git master, which only needs to be run on a single distro, for which Ubuntu 20.04 is picked as a stable long life base. For mingw, we only test against libvirt git master, using Fedora rawhide. It is expected that any issues against older libvirt will have already been caught by the native builds. Several distros are not included because they don't provide the package pre-requisites. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .gitlab-ci.yml | 163 ++++++++++++++++++ ci/containers/README.rst | 14 ++ ci/containers/libvirt-debian-10.Dockerfile | 64 +++++++ ci/containers/libvirt-debian-9.Dockerfile | 67 +++++++ ci/containers/libvirt-debian-sid.Dockerfile | 64 +++++++ ci/containers/libvirt-fedora-31.Dockerfile | 64 +++++++ ci/containers/libvirt-fedora-32.Dockerfile | 64 +++++++ .../libvirt-fedora-rawhide.Dockerfile | 65 +++++++ ci/containers/libvirt-ubuntu-1804.Dockerfile | 67 +++++++ ci/containers/libvirt-ubuntu-2004.Dockerfile | 69 ++++++++ ci/containers/refresh | 27 +++ 11 files changed, 728 insertions(+) create mode 100644 ci/containers/README.rst create mode 100644 ci/containers/libvirt-debian-10.Dockerfile create mode 100644 ci/containers/libvirt-debian-9.Dockerfile create mode 100644 ci/containers/libvirt-debian-sid.Dockerfile create mode 100644 ci/containers/libvirt-fedora-31.Dockerfile create mode 100644 ci/containers/libvirt-fedora-32.Dockerfile create mode 100644 ci/containers/libvirt-fedora-rawhide.Dockerfile create mode 100644 ci/containers/libvirt-ubuntu-1804.Dockerfile create mode 100644 ci/containers/libvirt-ubuntu-2004.Dockerfile create mode 100755 ci/containers/refresh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50dae92..c12a262 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,87 @@ stages: - prebuild + - containers + - builds + +.container_job_template: &container_job_definition + image: docker:stable + stage: containers + services: + - docker:dind + before_script: + - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest" + - export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt-sandbox/ci-$NAME:latest" + - docker info + - docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" + script: + - docker pull "$TAG" || docker pull "$COMMON_TAG" || true + - docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" -f "ci/containers/libvirt-$NAME.Dockerfile" ci + - docker push "$TAG" + after_script: + - docker logout + +.script_variables: &script_variables | + export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" + export SCRATCH_DIR="/tmp/scratch" + export VROOT="$SCRATCH_DIR/vroot" + export CCACHE_DIR="$PWD/ccache" + export CCACHE_MAXSIZE="500M" + export PATH="$CCACHE_WRAPPERSDIR:$VROOT/bin:$PATH" + export PKG_CONFIG_PATH="$VROOT/lib/pkgconfig" + export XDG_DATA_DIRS="$VROOT/share:/usr/share" + export GI_TYPELIB_PATH="$VROOT/lib/girepository-1.0" + +.git_native_build_job_template: &git_native_build_job_definition + image: $CI_REGISTRY_IMAGE/ci-$NAME:latest + stage: builds + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" + before_script: + - *script_variables + - export LD_LIBRARY_PATH="$VROOT/lib" + script: + - pushd "$PWD" + - mkdir -p "$SCRATCH_DIR" + - cd "$SCRATCH_DIR" + - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git + - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git + - mkdir libvirt/build + - cd libvirt/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd + - $MAKE install + - cd ../.. + - mkdir libvirt-glib/build + - cd libvirt-glib/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd + - $MAKE install + - popd + - mkdir build + - cd build + - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc + - $MAKE install + - $MAKE dist + - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt-sandbox*.tar.gz ; fi + +.dist_native_build_job_template: &dist_native_build_job_definition + image: $CI_REGISTRY_IMAGE/ci-$NAME:latest + stage: builds + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" + before_script: + - *script_variables + script: + - mkdir build + - cd build + - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc + - $MAKE install + - $MAKE dist + - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild -ta libvirt-sandbox*.tar.gz ; fi + # Check that all commits are signed-off for the DCO. # Skip on "libvirt" namespace, since we only need to run @@ -14,3 +95,85 @@ check-dco: except: variables: - $CI_PROJECT_NAMESPACE == 'libvirt' + +x64-debian-9-container: + <<: *container_job_definition + variables: + NAME: debian-9 + +x64-debian-10-container: + <<: *container_job_definition + variables: + NAME: debian-10 + +x64-debian-sid-container: + <<: *container_job_definition + variables: + NAME: debian-sid + +x64-fedora-31-container: + <<: *container_job_definition + variables: + NAME: fedora-31 + +x64-fedora-32-container: + <<: *container_job_definition + variables: + NAME: fedora-32 + +x64-fedora-rawhide-container: + <<: *container_job_definition + variables: + NAME: fedora-rawhide + +x64-ubuntu-1804-container: + <<: *container_job_definition + variables: + NAME: ubuntu-1804 + +x64-ubuntu-2004-container: + <<: *container_job_definition + variables: + NAME: ubuntu-2004 + + + +x64-debian-9-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: debian-9 + +x64-debian-10-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: debian-10 + +x64-debian-sid-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: debian-sid + +x64-fedora-31-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: fedora-31 + +x64-fedora-32-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: fedora-32 + +x64-fedora-rawhide-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: fedora-rawhide + +x64-ubuntu-1804-dist-build: + <<: *dist_native_build_job_definition + variables: + NAME: ubuntu-1804 + +x64-ubuntu-2004-git-build: + <<: *git_native_build_job_definition + variables: + NAME: ubuntu-2004 diff --git a/ci/containers/README.rst b/ci/containers/README.rst new file mode 100644 index 0000000..530897e --- /dev/null +++ b/ci/containers/README.rst @@ -0,0 +1,14 @@ +CI job assets +============= + +This directory contains assets used in the automated CI jobs, most +notably the Dockerfiles used to build container images in which the +CI jobs then run. + +The ``refresh`` script is used to re-create the Dockerfiles using the +``lcitool`` command that is provided by repo +https://gitlab.com/libvirt/libvirt-ci + +The containers are built during the CI process and cached in the GitLab +container registry of the project doing the build. The cached containers +can be deleted at any time and will be correctly rebuilt. diff --git a/ci/containers/libvirt-debian-10.Dockerfile b/ci/containers/libvirt-debian-10.Dockerfile new file mode 100644 index 0000000..51f79e2 --- /dev/null +++ b/ci/containers/libvirt-debian-10.Dockerfile @@ -0,0 +1,64 @@ +FROM debian:10 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + gcc \ + gdb \ + gettext \ + git \ + gtk-doc-tools \ + libc-dev-bin \ + libc6-dev \ + libcap-ng-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + liblzma-dev \ + libselinux1-dev \ + libtirpc-dev \ + libtool \ + libtool-bin \ + libvirt-dev \ + libvirt-glib-1.0-dev \ + libxml2-dev \ + locales \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconf \ + python3 \ + python3-setuptools \ + python3-wheel \ + screen \ + strace \ + sudo \ + vim \ + zlib1g-dev && \ + apt-get autoremove -y && \ + apt-get autoclean -y && \ + sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ + dpkg-reconfigure locales && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-debian-9.Dockerfile b/ci/containers/libvirt-debian-9.Dockerfile new file mode 100644 index 0000000..cf94a67 --- /dev/null +++ b/ci/containers/libvirt-debian-9.Dockerfile @@ -0,0 +1,67 @@ +FROM debian:9 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + gcc \ + gdb \ + gettext \ + git \ + gtk-doc-tools \ + libc-dev-bin \ + libc6-dev \ + libcap-ng-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + liblzma-dev \ + libselinux1-dev \ + libtirpc-dev \ + libtool \ + libtool-bin \ + libvirt-dev \ + libvirt-glib-1.0-dev \ + libxml2-dev \ + locales \ + lsof \ + make \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconf \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + screen \ + strace \ + sudo \ + vim \ + zlib1g-dev && \ + apt-get autoremove -y && \ + apt-get autoclean -y && \ + sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ + dpkg-reconfigure locales && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +RUN pip3 install \ + meson==0.49.0 + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-debian-sid.Dockerfile b/ci/containers/libvirt-debian-sid.Dockerfile new file mode 100644 index 0000000..6a34306 --- /dev/null +++ b/ci/containers/libvirt-debian-sid.Dockerfile @@ -0,0 +1,64 @@ +FROM debian:sid + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + gcc \ + gdb \ + gettext \ + git \ + gtk-doc-tools \ + libc-dev-bin \ + libc6-dev \ + libcap-ng-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + liblzma-dev \ + libselinux1-dev \ + libtirpc-dev \ + libtool \ + libtool-bin \ + libvirt-dev \ + libvirt-glib-1.0-dev \ + libxml2-dev \ + locales \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconf \ + python3 \ + python3-setuptools \ + python3-wheel \ + screen \ + strace \ + sudo \ + vim \ + zlib1g-dev && \ + apt-get autoremove -y && \ + apt-get autoclean -y && \ + sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ + dpkg-reconfigure locales && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-fedora-31.Dockerfile b/ci/containers/libvirt-fedora-31.Dockerfile new file mode 100644 index 0000000..6e0da18 --- /dev/null +++ b/ci/containers/libvirt-fedora-31.Dockerfile @@ -0,0 +1,64 @@ +FROM fedora:31 + +RUN dnf update -y && \ + dnf install -y \ + autoconf \ + automake \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + cppi \ + gcc \ + gdb \ + gettext \ + gettext-devel \ + git \ + glib2-devel \ + glibc-devel \ + glibc-langpack-en \ + glibc-static \ + gobject-introspection-devel \ + gtk-doc \ + libcap-ng-devel \ + libselinux-devel \ + libtirpc-devel \ + libtool \ + libvirt-devel \ + libvirt-gobject-devel \ + libxml2-devel \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconfig \ + python3 \ + python3-setuptools \ + python3-wheel \ + rpcgen \ + rpm-build \ + screen \ + strace \ + sudo \ + vim \ + xz-devel \ + xz-static \ + zlib-devel \ + zlib-static && \ + dnf autoremove -y && \ + dnf clean all -y && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-fedora-32.Dockerfile b/ci/containers/libvirt-fedora-32.Dockerfile new file mode 100644 index 0000000..5d86af2 --- /dev/null +++ b/ci/containers/libvirt-fedora-32.Dockerfile @@ -0,0 +1,64 @@ +FROM fedora:32 + +RUN dnf update -y && \ + dnf install -y \ + autoconf \ + automake \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + cppi \ + gcc \ + gdb \ + gettext \ + gettext-devel \ + git \ + glib2-devel \ + glibc-devel \ + glibc-langpack-en \ + glibc-static \ + gobject-introspection-devel \ + gtk-doc \ + libcap-ng-devel \ + libselinux-devel \ + libtirpc-devel \ + libtool \ + libvirt-devel \ + libvirt-gobject-devel \ + libxml2-devel \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconfig \ + python3 \ + python3-setuptools \ + python3-wheel \ + rpcgen \ + rpm-build \ + screen \ + strace \ + sudo \ + vim \ + xz-devel \ + xz-static \ + zlib-devel \ + zlib-static && \ + dnf autoremove -y && \ + dnf clean all -y && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-fedora-rawhide.Dockerfile b/ci/containers/libvirt-fedora-rawhide.Dockerfile new file mode 100644 index 0000000..8a299fd --- /dev/null +++ b/ci/containers/libvirt-fedora-rawhide.Dockerfile @@ -0,0 +1,65 @@ +FROM fedora:rawhide + +RUN dnf update -y --nogpgcheck fedora-gpg-keys && \ + dnf update -y && \ + dnf install -y \ + autoconf \ + automake \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + cppi \ + gcc \ + gdb \ + gettext \ + gettext-devel \ + git \ + glib2-devel \ + glibc-devel \ + glibc-langpack-en \ + glibc-static \ + gobject-introspection-devel \ + gtk-doc \ + libcap-ng-devel \ + libselinux-devel \ + libtirpc-devel \ + libtool \ + libvirt-devel \ + libvirt-gobject-devel \ + libxml2-devel \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconfig \ + python3 \ + python3-setuptools \ + python3-wheel \ + rpcgen \ + rpm-build \ + screen \ + strace \ + sudo \ + vim \ + xz-devel \ + xz-static \ + zlib-devel \ + zlib-static && \ + dnf autoremove -y && \ + dnf clean all -y && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-ubuntu-1804.Dockerfile b/ci/containers/libvirt-ubuntu-1804.Dockerfile new file mode 100644 index 0000000..bea1fb4 --- /dev/null +++ b/ci/containers/libvirt-ubuntu-1804.Dockerfile @@ -0,0 +1,67 @@ +FROM ubuntu:18.04 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + gcc \ + gdb \ + gettext \ + git \ + gtk-doc-tools \ + libc-dev-bin \ + libc6-dev \ + libcap-ng-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + liblzma-dev \ + libselinux1-dev \ + libtirpc-dev \ + libtool \ + libtool-bin \ + libvirt-dev \ + libvirt-glib-1.0-dev \ + libxml2-dev \ + locales \ + lsof \ + make \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconf \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + screen \ + strace \ + sudo \ + vim \ + zlib1g-dev && \ + apt-get autoremove -y && \ + apt-get autoclean -y && \ + sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ + dpkg-reconfigure locales && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +RUN pip3 install \ + meson==0.49.0 + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/libvirt-ubuntu-2004.Dockerfile b/ci/containers/libvirt-ubuntu-2004.Dockerfile new file mode 100644 index 0000000..0c2c4d6 --- /dev/null +++ b/ci/containers/libvirt-ubuntu-2004.Dockerfile @@ -0,0 +1,69 @@ +FROM ubuntu:20.04 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bash-completion \ + ca-certificates \ + ccache \ + chrony \ + gcc \ + gdb \ + gettext \ + git \ + gtk-doc-tools \ + libc-dev-bin \ + libc6-dev \ + libcap-ng-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libgnutls28-dev \ + liblzma-dev \ + libnl-3-dev \ + libnl-route-3-dev \ + libselinux1-dev \ + libtirpc-dev \ + libtool \ + libtool-bin \ + libxml2-dev \ + libxml2-utils \ + locales \ + lsof \ + make \ + meson \ + net-tools \ + ninja-build \ + patch \ + perl \ + pkgconf \ + python3 \ + python3-docutils \ + python3-setuptools \ + python3-wheel \ + screen \ + strace \ + sudo \ + valac \ + vim \ + xsltproc \ + zlib1g-dev && \ + apt-get autoremove -y && \ + apt-get autoclean -y && \ + sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ + dpkg-reconfigure locales && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc) + +ENV LANG "en_US.UTF-8" + +ENV MAKE "/usr/bin/make" +ENV NINJA "/usr/bin/ninja" +ENV PYTHON "/usr/bin/python3" + +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/refresh b/ci/containers/refresh new file mode 100755 index 0000000..ce65700 --- /dev/null +++ b/ci/containers/refresh @@ -0,0 +1,27 @@ +#!/bin/sh + +if test -z "$1" +then + echo "syntax: $0 PATH-TO-LCITOOL" + exit 1 +fi + +LCITOOL=$1 + +if ! test -x "$LCITOOL" +then + echo "$LCITOOL is not executable" + exit 1 +fi + +HOSTS=$($LCITOOL hosts | grep -v -E '(freebsd|centos|opensuse)') + +for host in $HOSTS +do + if test "$host" = "libvirt-ubuntu-2004" + then + $LCITOOL dockerfile $host libvirt+minimal,libvirt-glib,libvirt-sandbox > $host.Dockerfile + else + $LCITOOL dockerfile $host libvirt+dist,libvirt-glib+dist,libvirt-sandbox > $host.Dockerfile + fi +done -- 2.26.2

On Wed, 2020-06-17 at 19:06 +0100, Daniel P. Berrangé wrote: [...]
+.script_variables: &script_variables | + export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" + export SCRATCH_DIR="/tmp/scratch" + export VROOT="$SCRATCH_DIR/vroot" + export CCACHE_DIR="$PWD/ccache" + export CCACHE_MAXSIZE="500M" + export PATH="$CCACHE_WRAPPERSDIR:$VROOT/bin:$PATH" + export PKG_CONFIG_PATH="$VROOT/lib/pkgconfig" + export XDG_DATA_DIRS="$VROOT/share:/usr/share" + export GI_TYPELIB_PATH="$VROOT/lib/girepository-1.0" + +.git_native_build_job_template: &git_native_build_job_definition + image: $CI_REGISTRY_IMAGE/ci-$NAME:latest + stage: builds + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" + before_script: + - *script_variables + - export LD_LIBRARY_PATH="$VROOT/lib"
Same as libvirt-glib, LD_LIBRARY_PATH can be part of script_variables without affecting the other build jobs.
+ script: + - pushd "$PWD" + - mkdir -p "$SCRATCH_DIR" + - cd "$SCRATCH_DIR" + - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git + - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git + - mkdir libvirt/build + - cd libvirt/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd + - $MAKE install + - cd ../.. + - mkdir libvirt-glib/build + - cd libvirt-glib/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd
You don't need --without-libvirtd for this one ;)
+ - $MAKE install + - popd + - mkdir build + - cd build + - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc + - $MAKE install + - $MAKE dist + - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt-sandbox*.tar.gz ; fi
We need to run '$MAKE check' as well. I think we missed that for a few projects already: that's fine, we're going to need at least one additional pass to achieve some level of consistency across the namespace, since we're learning new things as we go :) Speaking of which, I suggest that we start organizing the script for git builds a bit differently: script: - mkdir -p "$SCRATCH_DIR" - pushd "$SCRATCH_DIR" - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git - mkdir libvirt/build - pushd libvirt/build - # ... - popd - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git - mkdir libvirt-glib/build - pushd libvirt-glib/build - # ... - popd - popd - mkdir build - cd build - # ... This avoids the unnecessary initial pushd/cd combination, keeps builds for each project neatly separated, and avoids using relative paths for most things. What do you think? [...]
+if ! test -x "$LCITOOL" +then + echo "$LCITOOL is not executable" + exit 1 +fi + +HOSTS=$($LCITOOL hosts | grep -v -E '(freebsd|centos|opensuse)')
According to host_vars/libvirt-opensuse-151/main.yml playbooks/build/projects/libvirt-sandbox.yml in libvirt-ci, libvirt-sandbox can be built on openSUSE just fine; I just tried it locally to double-check and had no problems with it either. So, please don't exclude openSUSE here.
+for host in $HOSTS +do + if test "$host" = "libvirt-ubuntu-2004" + then + $LCITOOL dockerfile $host libvirt+minimal,libvirt-glib,libvirt-sandbox > $host.Dockerfile + else + $LCITOOL dockerfile $host libvirt+dist,libvirt-glib+dist,libvirt-sandbox > $host.Dockerfile
This fails for me because libvirt-glib+dist is not know to lcitool. I assume you have local patches that add the project - can you please open a MR against libvirt-ci and mention it in the commit message, so that I can check everything locally during review? -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Jun 18, 2020 at 12:01:13PM +0200, Andrea Bolognani wrote:
On Wed, 2020-06-17 at 19:06 +0100, Daniel P. Berrangé wrote: [...]
+.script_variables: &script_variables | + export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" + export SCRATCH_DIR="/tmp/scratch" + export VROOT="$SCRATCH_DIR/vroot" + export CCACHE_DIR="$PWD/ccache" + export CCACHE_MAXSIZE="500M" + export PATH="$CCACHE_WRAPPERSDIR:$VROOT/bin:$PATH" + export PKG_CONFIG_PATH="$VROOT/lib/pkgconfig" + export XDG_DATA_DIRS="$VROOT/share:/usr/share" + export GI_TYPELIB_PATH="$VROOT/lib/girepository-1.0" + +.git_native_build_job_template: &git_native_build_job_definition + image: $CI_REGISTRY_IMAGE/ci-$NAME:latest + stage: builds + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" + before_script: + - *script_variables + - export LD_LIBRARY_PATH="$VROOT/lib"
Same as libvirt-glib, LD_LIBRARY_PATH can be part of script_variables without affecting the other build jobs.
Yep.
+ script: + - pushd "$PWD" + - mkdir -p "$SCRATCH_DIR" + - cd "$SCRATCH_DIR" + - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git + - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git + - mkdir libvirt/build + - cd libvirt/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd + - $MAKE install + - cd ../.. + - mkdir libvirt-glib/build + - cd libvirt-glib/build + - ../autogen.sh --prefix="$VROOT" --without-libvirtd
You don't need --without-libvirtd for this one ;)
Opps
+ - $MAKE install + - popd + - mkdir build + - cd build + - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc + - $MAKE install + - $MAKE dist + - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt-sandbox*.tar.gz ; fi
We need to run '$MAKE check' as well.
Yep will add.
Speaking of which, I suggest that we start organizing the script for git builds a bit differently:
script: - mkdir -p "$SCRATCH_DIR" - pushd "$SCRATCH_DIR" - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git - mkdir libvirt/build - pushd libvirt/build - # ... - popd - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git - mkdir libvirt-glib/build - pushd libvirt-glib/build - # ... - popd - popd - mkdir build - cd build - # ...
This avoids the unnecessary initial pushd/cd combination, keeps builds for each project neatly separated, and avoids using relative paths for most things. What do you think?
For now I'd rather keep the consistent approach we've already used for other repos. I think there might be better ways to deal with the builds later, perhaps using cross-repo include files for the deps.
+if ! test -x "$LCITOOL" +then + echo "$LCITOOL is not executable" + exit 1 +fi + +HOSTS=$($LCITOOL hosts | grep -v -E '(freebsd|centos|opensuse)')
According to
host_vars/libvirt-opensuse-151/main.yml playbooks/build/projects/libvirt-sandbox.yml
in libvirt-ci, libvirt-sandbox can be built on openSUSE just fine; I just tried it locally to double-check and had no problems with it either. So, please don't exclude openSUSE here.
That was doing a from git build, where as this is doing a from dist build, but I've found the missing packages for this now.
+for host in $HOSTS +do + if test "$host" = "libvirt-ubuntu-2004" + then + $LCITOOL dockerfile $host libvirt+minimal,libvirt-glib,libvirt-sandbox > $host.Dockerfile + else + $LCITOOL dockerfile $host libvirt+dist,libvirt-glib+dist,libvirt-sandbox > $host.Dockerfile
This fails for me because libvirt-glib+dist is not know to lcitool. I assume you have local patches that add the project - can you please open a MR against libvirt-ci and mention it in the commit message, so that I can check everything locally during review?
Yes I have libvirt-ci changes to submit after this is finalized. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Fri, 2020-06-19 at 15:23 +0100, Daniel P. Berrangé wrote:
On Thu, Jun 18, 2020 at 12:01:13PM +0200, Andrea Bolognani wrote:
Speaking of which, I suggest that we start organizing the script for git builds a bit differently: [...]
This avoids the unnecessary initial pushd/cd combination, keeps builds for each project neatly separated, and avoids using relative paths for most things. What do you think?
For now I'd rather keep the consistent approach we've already used for other repos. I think there might be better ways to deal with the builds later, perhaps using cross-repo include files for the deps.
Sounds good. As I said somewhere else we're going to need at least a second pass anyway :) With regards to the idea of having common include files, that's something that is done quite commonly in large GitLab instances such as those for Debian[1] or freedesktop.org[2], and I definitely support exploring it as a way to reduce the amount of repetitive code we have to keep in each project's .gitlab-ci.yml.
+HOSTS=$($LCITOOL hosts | grep -v -E '(freebsd|centos|opensuse)')
According to
host_vars/libvirt-opensuse-151/main.yml playbooks/build/projects/libvirt-sandbox.yml
in libvirt-ci, libvirt-sandbox can be built on openSUSE just fine; I just tried it locally to double-check and had no problems with it either. So, please don't exclude openSUSE here.
That was doing a from git build, where as this is doing a from dist build, but I've found the missing packages for this now.
Right, the dist build is the one I tried. Of course I had to install the libvirt-glib package first :)
+for host in $HOSTS +do + if test "$host" = "libvirt-ubuntu-2004" + then + $LCITOOL dockerfile $host libvirt+minimal,libvirt-glib,libvirt-sandbox > $host.Dockerfile + else + $LCITOOL dockerfile $host libvirt+dist,libvirt-glib+dist,libvirt-sandbox > $host.Dockerfile
This fails for me because libvirt-glib+dist is not know to lcitool. I assume you have local patches that add the project - can you please open a MR against libvirt-ci and mention it in the commit message, so that I can check everything locally during review?
Yes I have libvirt-ci changes to submit after this is finalized.
I see you've created the merge request now. Please just open it at the same time in the future, thanks! [1] https://salsa.debian.org/salsa-ci-team/pipeline [2] https://gitlab.freedesktop.org/freedesktop/ci-templates -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé