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

Andrea Bolognani abologna at redhat.com
Thu Jun 18 10:01:13 UTC 2020


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




More information about the libvir-list mailing list