[libvirt] [PATCH v2 2/2] travis: convert ubuntu, centos & mingw builds to use new make rules

Daniel P. Berrangé posted 2 patches 6 years, 11 months ago
There is a newer version of this series
[libvirt] [PATCH v2 2/2] travis: convert ubuntu, centos & mingw builds to use new make rules
Posted by Daniel P. Berrangé 6 years, 11 months ago
Change the travis configuration to invoke the new cibuild-$IMAGE target
instead of directly running docker. This guarantees that when a
developer runs cibuild-$IMAGE locally, the container build setup is
identical to that used in Travis, with exception of the host kernel
and docker version.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .travis.yml | 48 ++++++++++--------------------------------------
 1 file changed, 10 insertions(+), 38 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 55ba340a34..c093dbf550 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,26 +11,30 @@ matrix:
         - docker
       env:
         - IMAGE="ubuntu-18"
-        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
-        - DOCKER_CMD="$LINUX_CMD"
+        - MAKE_ARGS="syntax-check distcheck DISTCHECK_CONFIGURE_FLAGS=--with-init-script-systemd"
+      script:
+        - make -f tests/Makefile.ci.inc cibuild-$IMAGE  MAKE_ARGS="$MAKE_ARGS"
     - services:
         - docker
       env:
         - IMAGE="centos-7"
-        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart"
-        - DOCKER_CMD="$LINUX_CMD"
+        - MAKE_ARGS="syntax-check distcheck DISTCHECK_CONFIGURE_FLAGS=--with-init-script-systemd"
+      script:
+        - make -f tests/Makefile.ci.inc cibuild-$IMAGE  MAKE_ARGS="$MAKE_ARGS"
     - services:
         - docker
       env:
         - IMAGE="fedora-rawhide"
         - MINGW="mingw32"
-        - DOCKER_CMD="$MINGW_CMD"
+      script:
+        - make -f tests/Makefile.ci.inc cibuild-$IMAGE CONFIGURE=$MINGW-configure MAKE_ARGS="$MAKE_ARGS"
     - services:
         - docker
       env:
         - IMAGE="fedora-rawhide"
         - MINGW="mingw64"
-        - DOCKER_CMD="$MINGW_CMD"
+      script:
+        - make -f tests/Makefile.ci.inc cibuild-$IMAGE CONFIGURE=$MINGW-configure MAKE_ARGS="$MAKE_ARGS"
     - compiler: clang
       language: c
       os: osx
@@ -39,44 +43,12 @@ matrix:
       script:
         /bin/sh -xc "$MACOS_CMD"
 
-script:
-  - docker run
-      -v $(pwd):/build
-      -w /build
-      -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG"
-      -e MINGW="$MINGW"
-      -e DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS"
-      "quay.io/libvirt/buildenv-$IMAGE:master"
-      /bin/sh -xc "$DOCKER_CMD"
-
 git:
   submodules: true
 
 env:
   global:
     - VIR_TEST_DEBUG=1
-    - LINUX_CMD="
-        ./autogen.sh &&
-        make -j3 syntax-check &&
-        make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=\"\$DISTCHECK_CONFIGURE_FLAGS\" ||
-        (
-          echo '=== LOG FILE(S) START ===';
-          find -name test-suite.log | xargs cat;
-          echo '=== LOG FILE(S) END ===';
-          exit 1
-        )
-      "
-    - MINGW_CMD="
-        NOCONFIGURE=1 ./autogen.sh &&
-        \$MINGW-configure &&
-        make -j3 ||
-        (
-          echo '=== LOG FILE(S) START ===';
-          find -name test-suite.log | xargs cat;
-          echo '=== LOG FILE(S) END ===';
-          exit 1
-        )
-      "
     # We can't run 'distcheck' or 'syntax-check' because they fail on
     # macOS, but doing 'install' and 'dist' gives us some useful coverage
     - MACOS_CMD="
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] travis: convert ubuntu, centos & mingw builds to use new make rules
Posted by Andrea Bolognani 6 years, 10 months ago
On Wed, 2019-03-06 at 09:34 +0000, Daniel P. Berrangé wrote:
> +++ b/.travis.yml
> @@ -11,26 +11,30 @@ matrix:
>          - docker
>        env:
>          - IMAGE="ubuntu-18"
> -        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
> -        - DOCKER_CMD="$LINUX_CMD"
> +        - MAKE_ARGS="syntax-check distcheck DISTCHECK_CONFIGURE_FLAGS=--with-init-script-systemd"
> +      script:
> +        - make -f tests/Makefile.ci.inc cibuild-$IMAGE  MAKE_ARGS="$MAKE_ARGS"

Having a separate 'script' for each job in the matrix defeats the
purpose of setting values in the environment.

I would drop MINGW_CMD, change the existing LINUX_CMD to

  env:
    global:
      - LINUX_CMD='
          if test "$MINGW"; then
            make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS" CONFIGURE="$MINGW-configure";
          else
            make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS";
          fi
        '

and the existing default script to

  script:
    - /bin/sh -xc "$LINUX_CMD"

Alternatively, you can drop all _CMD variables, including MACOS_CMD,
and put the shell code right into the 'script' directives, but doing
so would mean losing the tracing feature which can be useful to track
down build issues...

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] travis: convert ubuntu, centos & mingw builds to use new make rules
Posted by Daniel P. Berrangé 6 years, 10 months ago
On Fri, Mar 15, 2019 at 02:27:55PM +0100, Andrea Bolognani wrote:
> On Wed, 2019-03-06 at 09:34 +0000, Daniel P. Berrangé wrote:
> > +++ b/.travis.yml
> > @@ -11,26 +11,30 @@ matrix:
> >          - docker
> >        env:
> >          - IMAGE="ubuntu-18"
> > -        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
> > -        - DOCKER_CMD="$LINUX_CMD"
> > +        - MAKE_ARGS="syntax-check distcheck DISTCHECK_CONFIGURE_FLAGS=--with-init-script-systemd"
> > +      script:
> > +        - make -f tests/Makefile.ci.inc cibuild-$IMAGE  MAKE_ARGS="$MAKE_ARGS"
> 
> Having a separate 'script' for each job in the matrix defeats the
> purpose of setting values in the environment.

This could be written just using the script: entry without any
env vars, but the env vars have the useful property that they
are displayed in the build result page. So you can see the
difference in each matrix entry at a glance.

> I would drop MINGW_CMD, change the existing LINUX_CMD to
> 
>   env:
>     global:
>       - LINUX_CMD='
>           if test "$MINGW"; then
>             make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS" CONFIGURE="$MINGW-configure";
>           else
>             make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS";
>           fi
>         '
> 
> and the existing default script to
> 
>   script:
>     - /bin/sh -xc "$LINUX_CMD"

I really don't like having so many levels of indirection in the
commands. It gets painful to understand, especially when you
consider the shell quoting & escaping needs.

I'd rather have duplication of the "script" entry that is easy
to understand.

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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] travis: convert ubuntu, centos & mingw builds to use new make rules
Posted by Andrea Bolognani 6 years, 10 months ago
On Fri, 2019-03-15 at 13:44 +0000, Daniel P. Berrangé wrote:
> On Fri, Mar 15, 2019 at 02:27:55PM +0100, Andrea Bolognani wrote:
> > On Wed, 2019-03-06 at 09:34 +0000, Daniel P. Berrangé wrote:
> > > +++ b/.travis.yml
> > > @@ -11,26 +11,30 @@ matrix:
> > >          - docker
> > >        env:
> > >          - IMAGE="ubuntu-18"
> > > -        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
> > > -        - DOCKER_CMD="$LINUX_CMD"
> > > +        - MAKE_ARGS="syntax-check distcheck DISTCHECK_CONFIGURE_FLAGS=--with-init-script-systemd"
> > > +      script:
> > > +        - make -f tests/Makefile.ci.inc cibuild-$IMAGE  MAKE_ARGS="$MAKE_ARGS"
> > 
> > Having a separate 'script' for each job in the matrix defeats the
> > purpose of setting values in the environment.
> 
> This could be written just using the script: entry without any
> env vars, but the env vars have the useful property that they
> are displayed in the build result page. So you can see the
> difference in each matrix entry at a glance.

Agreed, that's why I didn't suggest touching the environment :)

> > I would drop MINGW_CMD, change the existing LINUX_CMD to
> > 
> >   env:
> >     global:
> >       - LINUX_CMD='
> >           if test "$MINGW"; then
> >             make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS" CONFIGURE="$MINGW-configure";
> >           else
> >             make -f tests/Makefile.ci.inc "cibuild-$IMAGE" MAKE_ARGS="$MAKE_ARGS";
> >           fi
> >         '
> > 
> > and the existing default script to
> > 
> >   script:
> >     - /bin/sh -xc "$LINUX_CMD"
> 
> I really don't like having so many levels of indirection in the
> commands. It gets painful to understand, especially when you
> consider the shell quoting & escaping needs.
> 
> I'd rather have duplication of the "script" entry that is easy
> to understand.

Then go for the second suggestion, which you snipped in your reply:

> > Alternatively, you can drop all _CMD variables, including MACOS_CMD,
> > and put the shell code right into the 'script' directives, but doing
> > so would mean losing the tracing feature which can be useful to track
> > down build issues...

Doing so would remove the indirection, even for macOS builds, while
still avoiding duplicated script directives.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list