[libvirt] [PATCH] travis: switch to using Ubuntu 16.04 and 18.04

Daniel P. Berrangé berrange at redhat.com
Wed Jun 6 10:28:27 UTC 2018


On Wed, Jun 06, 2018 at 11:27:38AM +0200, Andrea Bolognani wrote:
> On Tue, 2018-06-05 at 18:47 +0100, Daniel P. Berrangé wrote:
> > The container images provided by Travis only support Ubuntu 14.04,
> > however, Travis has ability to run docker, which allows the build
> > script to use arbitrary OS images. This takes advantage of that to
> > convert the build over to Ubuntu 16.04 and 18.04
> 
> Neat! I was not aware that was possible. TIL :)

Yeah, nor was I until yesterday when I found someone saying this is
the way to get off the ancient Ubuntu versions in Travis :-)

> > This is using the official Ubuntu provided images and installing
> > extra build deps required, as we previously did with Travis container
> > images.
> 
> Everything after this doesn't belong in the commit message IMHO.
> 
> > With the switch to Docker though, this can be improved, by
> > building custom Docker images with all the deps pre-installed which
> > will cut down build time. This can be driven from the package lists
> > in libvirt-jenkins-ci repo, to remove the duplication. This work
> > for future improvement though, this just does the minimal conversion
> > to match what we already do, but with newer distro.
> 
> We will probably want to do that, since installing packages takes
> quite a bit of time and using Docker like this apparently causes
> jobs to serialize, which makes shaving down time all the more
> important.

When I tested it, the jobs still ran in parallel. The key difference
is that it causes the jobs to be scheduled on the VM based infra
in Travis instead of the container based infra. There's a slightly
longer startup time for jobs but otherwise nothing changes. The
jobs still took approx 25-30 minutes to complete, which is the same
as before this change. Pre-built docker images will definitely cut
it down though, at least 5 minutes off perhaps more.

> I'm wondering if using Ubuntu 16.04 and 18.04 as base image is the
> best option, however. Pavel is trying to get more hardware assigned
> to us in the CentOS CI environment, and assuming that's successful
> we will get those distributions added there as well for full-stack
> testing; Travis CI is more useful for developers to smoke test
> their patch series before posting, however, and with that in mind
> I think it would be much better to run the build on the latest
> CentOS, Fedora, Debian and Ubuntu to give reasonable coverage,
> leaving up to CentOS CI to catch issues related to interactions
> with other components or compatibility with older distros after
> merge.

Yeah, I just picked ubuntu as an initial target since it is close
to what we have. I would like to evolve it to have similar options
for coverage as the main CI. Ideally at least one of centos,
ubuntu, fedora and mingw, so 5 jobs in total including macOS.

> [...]
> > +      before_install:
> 
> Not sure 'before_install' is the best choice here, I would probably
> have gone with 'script' instead.

Yes, cut+paste mistake.

> On the other hand, it seems like the distinction between job phases
> is fairly blurry, so it probably doesn't matter after all.
> 
> > +        - docker pull berrange/test
> 
> I'm pretty sure we don't want this :)

Opps, yes, thats cruft from my testing custom images

> 
> > +        - docker run
> > +            --privileged
> 
> Is '--privileged' really needed here? I'm not familiar enough
> with Docker, but it feels like we shouldn't need it. Feel free to
> point out exactly why I'm wrong :)

We need privileged because we have to apt-get install extra
packages. Once we switch to pre-built images we can drop
the --privileged arg.

> 
> > +            -v `pwd`:/build
> 
> Please use $(pwd) instead of `pwd`.
> 
> > +            -w /build
> > +            -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG"
> > +            -e PACKAGES="$PACKAGES"
> > +            -e DISTCHECK_FLAGS="$DISTCHECK_FLAGS"
> > +            ubuntu:18.04
> 
> It would be great to have the base image name in the environment
> as well, so that in case the build fails on only one of the
> Ubuntu versions you could easily tell from a quick look at the
> build summary which one that is.

Yeah, I'll see how to get that visible

> 
> [...]
> >        env:
> > -        - PYTHON=$(which python3)
> 
> You got rid of this variable entirely. I think we won't lose any
> coverage because configure will naturally pick python2 on 16.04
> and python3 on 18.04 (I can't check because Travis CI decided to
> only keep around a truncated log of my test run), but it was kinda
> nice to have that explicitly in the summary. As long as you can
> confirm the above is correct and no coverage is lost, though, I'm
> okay with the removal.

Yeah, I'll check

> 
> > -        - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
> > +        - DISTCHECK_FLAGS="--with-init-script=upstart"
> 
> You copied the wrong line here, we're going to test upstart twice.
> 
> I don't see a good reason to change the variable name, however:
> let's just stick with matching the name expected by distcheck
> itself.

ok

> 
> [...]
> >      - compiler: clang
> > +      language: c
> >        os: osx
> 
> You lost the ccache setting. That's probably okay because we
> install the package and set up PATH explicitly anyway.

The ccache setting applies to the "host", and so wouldn't
have an effect in side the docker container. I guess it
would still have affected ox-s though so I can re-add.

> 
> [...]
> > +      after_failure:
> > +        - echo '=== LOG FILE(S) START ==='
> > +        - find -name test-suite.log | xargs cat
> > +        - echo '=== LOG FILE(S) END ==='
> 
> This is simpler than the previous approach. I like it :)

Mostly because I couldn't figure out the right damn path to
use. It does have the benefit though that if gnulib tests
fail, we'll be catting the gnulib log file too.

> 
> [...]
> > +    - DOCKER_CMD="
> > +        apt-get update &&
> > +        apt-get install -y \$PACKAGES &&
> > +        ./autogen.sh --prefix=/build/install-root &&
> 
> Use
> 
>   --prefix=\$(pwd)/install-root
> 
> here for consistency with the macOS part.

ok

> 
> > +        make -j 3 &&
> 
> No space between '-j' and '3'.
> 
> > +        make -j 3 syntax-check &&
> > +        make -j 3 distcheck DISTCHECK_CONFIGURE_FLAGS=\$DISTCHECK_FLAGS ||
> 
> This won't work if we have more than a single flag, will it?

Good point, i'll quote it

> 
> > +        (
> > +          echo '=== LOG FILE(S) START ==='
> > +          find -name test-suite.log | xargs cat
> > +          echo '=== LOG FILE(S) END ==='
> > +          exit 1
> > +        )
> > +      "
> > +    - PACKAGES="
> 
> You lost the comment about this list being sorted alphabetically.

ok

> 
> > +        augeas-tools
> [...]
> > +        zfs-fuse"
> 
> Put the closing quote on a separate line for neater future diffs.
> 
> -- 
> Andrea Bolognani / Red Hat / Virtualization

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




More information about the libvir-list mailing list