[PATCH libvirt-cim 1/2] gitlab: introduce CI jobs testing git master & distro libvirt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The sandbox build needs to validate two axis

  - A variety of distro versions
  - 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 CentOS 7 is picked as a stable long life
base.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 .gitlab-ci.yml                                | 130 ++++++++++++++++++
 ci/containers/README.rst                      |  14 ++
 ci/containers/libvirt-centos-7.Dockerfile     |  89 ++++++++++++
 ci/containers/libvirt-fedora-31.Dockerfile    |  56 ++++++++
 ci/containers/libvirt-fedora-32.Dockerfile    |  56 ++++++++
 .../libvirt-fedora-rawhide.Dockerfile         |  65 +++++++++
 ci/containers/refresh                         |  27 ++++
 7 files changed, 437 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 ci/containers/README.rst
 create mode 100644 ci/containers/libvirt-centos-7.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 100755 ci/containers/refresh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..75d34c3
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,130 @@
+
+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-cim/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 LD_LIBRARY_PATH="$VROOT/lib"
+
+.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
+  script:
+    - pushd "$PWD"
+    - mkdir -p "$SCRATCH_DIR"
+    - cd "$SCRATCH_DIR"
+    - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
+    - mkdir libvirt/build
+    - cd libvirt/build
+    - ../autogen.sh --prefix="$VROOT" --without-libvirtd
+    - $MAKE install
+    - popd
+    - mkdir build
+    - cd build
+    - ../autogen.sh --prefix="$VROOT"
+    - $MAKE install
+    - $MAKE dist
+    - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt-cim*.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"
+    - $MAKE install
+    - $MAKE dist
+    - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild -ta libvirt-cim*.tar.gz ; fi
+
+# Check that all commits are signed-off for the DCO.
+# Skip on "libvirt" namespace, since we only need to run
+# this test on developer's personal forks from which
+# merge requests are submitted
+check-dco:
+  stage: prebuild
+  image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master
+  script:
+    - /check-dco
+  except:
+    variables:
+      - $CI_PROJECT_NAMESPACE == 'libvirt'
+
+x64-centos-7-container:
+  <<: *container_job_definition
+  variables:
+    NAME: centos-7
+
+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-centos-7-dist-build:
+  <<: *dist_native_build_job_definition
+  variables:
+    NAME: centos-7
+
+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-git-build:
+  <<: *git_native_build_job_definition
+  variables:
+    NAME: fedora-rawhide
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-centos-7.Dockerfile b/ci/containers/libvirt-centos-7.Dockerfile
new file mode 100644
index 0000000..e0a3e42
--- /dev/null
+++ b/ci/containers/libvirt-centos-7.Dockerfile
@@ -0,0 +1,89 @@
+FROM centos:7
+
+RUN echo -e '[openvz]\n\
+name=OpenVZ addons\n\
+baseurl=https://download.openvz.org/virtuozzo/releases/openvz-7.0.11-235/x86_64/os/\n\
+enabled=1\n\
+gpgcheck=1\n\
+skip_if_unavailable=0\n\
+metadata_expire=6h\n\
+priority=90\n\
+includepkgs=libprl*' > /etc/yum.repos.d/openvz.repo && \
+    echo -e '-----BEGIN PGP PUBLIC KEY BLOCK-----\n\
+Version: GnuPG v2.0.22 (GNU/Linux)\n\
+\n\
+mI0EVl80nQEEAKrEeyeTCwrzS9kYedZ/sAc/GUqlb81C7pA9SaR3fyck5mVw1Ogk\n\
+YdmNBPM2kY7QDxR9F0EpSpnxSCAXZXugsQ8KzZ0DRLVeBDQyGs9IGK5hI0zzxIil\n\
+BzfvIexLiQQhLy7YlIi8Jt/uUqKkW0pIMNMGcduY97VATtczpncpkmSzABEBAAG0\n\
+SFZpcnR1b3p6byBUZWFtIChHUEcga2V5IHNpZ25hdHVyZSBmb3IgcGFja2FnZXMp\n\
+IDxzZWN1cml0eUB2aXJ0dW96em8uY29tPoi5BBMBAgAjBQJWXzSdAhsDBwsJCAcD\n\
+AgEGFQgCCQoLBBYCAwECHgECF4AACgkQygt9GUTNrSruIgP/er70Eyo73A1gfrjv\n\
+oPUkyo4rslVRZu3qqCwoMFtJc/Z/UxWgEka1buorlcGLa6eO/EZ49c0n+KGa4Kvt\n\
+EUboIq0yEu5i0FyAj92ifm+hNhoAbGfm0cZ4/fD0oGr3l8OsQo4+iHX4xAPwFe7Y\n\
+zABuB8I1ZDZ4OIp5tDfTTuF2LT24jQRWXzSdAQQAog2Aqb+Ptl68O7cQhWLjVGkj\n\
+yyigZrdeReLx3HloKJPBeQ/kA6uvMJc/IYS3uppMWXv9v+QenS6uhP1TUJ2k9FvM\n\
+t94MQZfALN7Vpf8AF+UeWu4Ru+y4BNzcFhrPhIFNFChOR2QqW6FkgE57D9I177NC\n\
+oJMyrlNe8wcGa178An8AEQEAAYifBBgBAgAJBQJWXzSdAhsMAAoJEMoLfRlEza0q\n\
+bKwD/3+OFVIEXnIv5XgdGRNX5fHggsUN1bb8gva7HANRlKdd4LD8foDM3F/yv/3V\n\
+igG14D5EjKz56SaBDNgiI4++hOzb2M8jhAsR86jxkXFrrP1U3ZNRKg6av9DPFAPS\n\
+WEiJKtQrZDJloqtyi/mmRa1VsV7RYR0VPJjhK/R8EQ7Ysshy\n\
+=fRMg\n\
+-----END PGP PUBLIC KEY BLOCK-----' > /etc/pki/rpm-gpg/RPM-GPG-KEY-OpenVZ && \
+    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-OpenVZ && \
+    yum install -y epel-release && \
+    yum update -y && \
+    yum install -y \
+        autoconf \
+        automake \
+        bash \
+        bash-completion \
+        ca-certificates \
+        ccache \
+        chrony \
+        gcc \
+        gdb \
+        gettext \
+        gettext-devel \
+        git \
+        glibc-common \
+        glibc-devel \
+        libcmpiutil-devel \
+        libconfig-devel \
+        libtool \
+        libuuid-devel \
+        libvirt-devel \
+        libxml2-devel \
+        libxslt-devel \
+        lsof \
+        make \
+        net-tools \
+        ninja-build \
+        patch \
+        perl \
+        pkgconfig \
+        python3 \
+        python3-pip \
+        python3-setuptools \
+        python3-wheel \
+        rpm-build \
+        screen \
+        strace \
+        sudo \
+        vim \
+        wget && \
+    yum autoremove -y && \
+    yum 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)
+
+RUN pip3 install \
+         meson==0.49.0
+
+ENV LANG "en_US.UTF-8"
+
+ENV MAKE "/usr/bin/make"
+ENV NINJA "/usr/bin/ninja-build"
+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..82080f3
--- /dev/null
+++ b/ci/containers/libvirt-fedora-31.Dockerfile
@@ -0,0 +1,56 @@
+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 \
+        glibc-devel \
+        glibc-langpack-en \
+        libcmpiutil-devel \
+        libconfig-devel \
+        libtool \
+        libuuid-devel \
+        libvirt-devel \
+        libxml2-devel \
+        libxslt-devel \
+        lsof \
+        make \
+        meson \
+        net-tools \
+        ninja-build \
+        patch \
+        perl \
+        pkgconfig \
+        python3 \
+        python3-setuptools \
+        python3-wheel \
+        rpm-build \
+        screen \
+        strace \
+        sudo \
+        vim \
+        wget && \
+    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..bb31261
--- /dev/null
+++ b/ci/containers/libvirt-fedora-32.Dockerfile
@@ -0,0 +1,56 @@
+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 \
+        glibc-devel \
+        glibc-langpack-en \
+        libcmpiutil-devel \
+        libconfig-devel \
+        libtool \
+        libuuid-devel \
+        libvirt-devel \
+        libxml2-devel \
+        libxslt-devel \
+        lsof \
+        make \
+        meson \
+        net-tools \
+        ninja-build \
+        patch \
+        perl \
+        pkgconfig \
+        python3 \
+        python3-setuptools \
+        python3-wheel \
+        rpm-build \
+        screen \
+        strace \
+        sudo \
+        vim \
+        wget && \
+    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..a4158b7
--- /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 \
+        gnutls-devel \
+        libcmpiutil-devel \
+        libconfig-devel \
+        libnl3-devel \
+        libtirpc-devel \
+        libtool \
+        libuuid-devel \
+        libvirt-devel \
+        libxml2 \
+        libxml2-devel \
+        libxslt \
+        libxslt-devel \
+        lsof \
+        make \
+        meson \
+        net-tools \
+        ninja-build \
+        patch \
+        perl \
+        pkgconfig \
+        python3 \
+        python3-docutils \
+        python3-setuptools \
+        python3-wheel \
+        rpcgen \
+        rpm-build \
+        screen \
+        strace \
+        sudo \
+        vim \
+        wget && \
+    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/refresh b/ci/containers/refresh
new file mode 100755
index 0000000..0cf6d45
--- /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 -E '(fedora|centos-7)')
+
+for host in $HOSTS
+do
+    if test "$host" = "libvirt-fedora-rawhide"
+    then
+        $LCITOOL dockerfile $host libvirt+minimal,libvirt+dist,libvirt-cim > $host.Dockerfile
+    else
+        $LCITOOL dockerfile $host libvirt+dist,libvirt-cim > $host.Dockerfile
+    fi
+done
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux