[PATCH v4 00/18] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles

Daniel P. Berrangé posted 18 patches 2 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211124130150.268230-1-berrange@redhat.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
There is a newer version of this series
.gitlab-ci.d/buildtest.yml                    |   2 +-
.gitlab-ci.d/cirrus/freebsd-12.vars           |  11 +-
.gitlab-ci.d/cirrus/freebsd-13.vars           |  11 +-
.gitlab-ci.d/cirrus/macos-11.vars             |  11 +-
.gitlab-ci.d/containers.yml                   |   5 -
.gitmodules                                   |   3 +
Makefile                                      |   2 +
docs/devel/testing.rst                        | 104 ++++++-
hw/display/qxl.c                              |  14 +-
include/ui/qemu-spice.h                       |   6 +
include/ui/sdl2.h                             |  11 +
meson.build                                   |   3 +-
tests/docker/dockerfiles/alpine.docker        | 175 ++++++++----
tests/docker/dockerfiles/centos8.docker       | 243 ++++++++--------
tests/docker/dockerfiles/fedora.docker        | 262 ++++++++++--------
tests/docker/dockerfiles/opensuse-leap.docker | 245 ++++++++--------
tests/docker/dockerfiles/ubuntu.docker        |  71 -----
tests/docker/dockerfiles/ubuntu1804.docker    | 255 +++++++++--------
tests/docker/dockerfiles/ubuntu2004.docker    | 257 +++++++++--------
tests/lcitool/Makefile.include                |  17 ++
tests/lcitool/libvirt-ci                      |   1 +
tests/lcitool/projects/qemu.yml               | 115 ++++++++
tests/lcitool/refresh                         |  96 +++++++
ui/clipboard.c                                |   3 +-
ui/spice-display.c                            |  11 +
25 files changed, 1217 insertions(+), 717 deletions(-)
delete mode 100644 tests/docker/dockerfiles/ubuntu.docker
create mode 100644 tests/lcitool/Makefile.include
create mode 160000 tests/lcitool/libvirt-ci
create mode 100644 tests/lcitool/projects/qemu.yml
create mode 100755 tests/lcitool/refresh
[PATCH v4 00/18] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles
Posted by Daniel P. Berrangé 2 years, 4 months ago
Currently the tests/docker/dockerfiles/*Dockerfile recipes are all hand
written by contributors. There is a common design pattern, but the set
of packages listed for installation leaves alot to be desired

 - There is no consistency at all across distros
 - Many potential build deps are not listed in the containers
 - Some packages are not used by QEMU at all
 - Adding new distros is an error prone task

The same applies to package lists for VMs, Cirrus CI / Travis CI, and
probably more.

This problem is not unique to QEMU, libvirt faced the exact same issues
and developed a program called "lcitool" which is part of the libvirt-ci
git repository to reduce the burden in this area.

Despite its name, this repository is not tied to libvirt, and so as well
as the 40+ libvirt git repos, it is also used by the libosinfo and
virt-viewer projects for their CI needs.

lcitool is capable of automating the installation and updating of VM
images, creation of dockerfiles and creation of standalone package
lists.

In this series I'm taking the easy step which is the generation of
dockerfiles and Cirrus CI variables, since that is where the most
immediate value lies for QEMU.

The key concept in lcitool that brings a huge win in maintainability
is that there is a single file which defines a mapping between a
build pre-requisite and the native package on each targetted distro.

   https://gitlab.com/libvirt/libvirt-ci/-/blob/master/guests/lcitool/lcitool/ansible/vars/mappings.yml

A project merely then to have its list of pre-requisites enumerated
For example:

   https://gitlab.com/libvirt/libvirt-ci/-/blob/master/guests/lcitool/lcitool/ansible/vars/projects/qemu.yml

The combination of these two files is enough to generate accurate
package lists for any supported distro. Currently supported distro
targets are

 $ lcitool targets
  alpine-314
  alpine-edge
  centos-8
  centos-stream-8
  centos-stream-9
  debian-10
  debian-11
  debian-sid
  fedora-34
  fedora-35
  fedora-rawhide
  freebsd-12
  freebsd-13
  freebsd-current
  macos-11
  opensuse-leap-152
  opensuse-tumbleweed
  ubuntu-1804
  ubuntu-2004

At the end of this series, I have dockerfiles auto-generated for QEMU
covering Ubuntu 18.04 & 20.04, CentOS 8, Fedora 35 and OpenSUSE 15.2
and Alpine Edge

lcitool is also capable of generating dockerfiles for cross-compiled
non-x86 architectures for Debian, and for mingw32/64 for Fedora. This
is driven from the very same mapping.yml file listed above, which has
attributes to indicate whether a given dependancy should be pulled from
the native or cross build target. Again this means that we have strong
guarantee of consistent deps being used between cross containers.

I have not converted cross containers in this series though, because
the way lcitool generated cross dockerfiles is different from how QEMU
does it. lcitool will always generate fully self-contained dockerfiles,
but QEMU currently uses layered dockerfiles for cross-builds, so all
cross builds share a common intermediate container.

I've got a pending enhancement to lcitool to support split layers
for the cross-buld dockerfiles. An alternative is to just use fully
self-contained dockerfiles for cross builds too though.

There is also scope for auto-generating the package lists for tests/vm,
but I've not attempted that yet. The same general idea appies - we just
call lcitool to spit out a yml file containing a list of native packages
for each VM target.

If converting tests/vm, we would need to add more distros to lcitool
mappings.yml to convert openbsd, netbsd, haiku since libvirt does not
target those distros itself.

I have provided a 'make lcitool-refresh' target that needs to be
invoked whenever the local files need re-generating with updated
package lists. This can be either when adding a new distro target
or when some build pre-requisite is added. This make target will
checkout the libvirt-ci.git submodule to do its work.


One unsolved problem here is that the rebase to Fedora 35 has
caused the oss-fuzz job in CI to reliably fail with a timeout.
Running locally on F35 the fuzz script never finishes even after
24 hours. There's a genuine problem hiding in there in the
tests or code itself, that newer clang has likely exposed.

Changed in v5:

 - Re-introduce use of git submodule
 - Pull qemu.yml package list into qemu.git not libvirt-ci.git
 - Improved make trget integration for refreshing files
 - Also convert Alpine dockerfile
 - Also generate cirrus CI variables files
 - Rebase fedora dockerfile to F35, since F33 is no longer
   supported by libvirt-ci as it is end of life by Fedora.

Changed in v4:

 - Refresh to cope with new libbpf, libffi & rtd theme packages
 - Drop use of git submodule
 - Improve documentation

Changed in v3:

 - Drop changes for CentOS 7
 - Catch up with newly added build deps
 - Add git submodule and make target for refresh

Changed in v2:

 - Remove more travis stuff from tests/docker/Makefile.include
 - Convert opensuse image to be auto-generated
 - Add SDL2_image package
 - QEMU package manifest is now officially merged in libvirt-ci.git

Daniel P. Berrangé (17):
  ui: avoid compiler warnings from unused clipboard info variable
  meson: require liburing >= 0.3
  ui: avoid warnings about directdb on Alpine / musl libc
  ci: explicitly skip I/O tests on alpine
  tests/docker: switch fedora image to release 35
  tests: integrate lcitool for generating build env manifests
  tests/docker: auto-generate centos8.docker with lcitool
  tests/docker: auto-generate fedora.docker with lcitool
  tests/docker: auto-generate ubuntu1804.docker with lcitool
  tests/docker: auto-generate ubuntu2004.docker with lcitool
  tests/docker: auto-generate opensuse-leap.docker with lcitool
  tests/docker: remove ubuntu.docker container
  .gitlab-ci.d/cirrus: auto-generate variables with lcitool
  tests/docker: updates to alpine package list
  tests/docker: fix sorting of alpine image package lists
  tests/docker: fully expand the alpine package list
  tests/docker: auto-generate alpine.docker with lcitool

John Snow (1):
  spice: Update QXLInterface for spice >= 0.15.0

 .gitlab-ci.d/buildtest.yml                    |   2 +-
 .gitlab-ci.d/cirrus/freebsd-12.vars           |  11 +-
 .gitlab-ci.d/cirrus/freebsd-13.vars           |  11 +-
 .gitlab-ci.d/cirrus/macos-11.vars             |  11 +-
 .gitlab-ci.d/containers.yml                   |   5 -
 .gitmodules                                   |   3 +
 Makefile                                      |   2 +
 docs/devel/testing.rst                        | 104 ++++++-
 hw/display/qxl.c                              |  14 +-
 include/ui/qemu-spice.h                       |   6 +
 include/ui/sdl2.h                             |  11 +
 meson.build                                   |   3 +-
 tests/docker/dockerfiles/alpine.docker        | 175 ++++++++----
 tests/docker/dockerfiles/centos8.docker       | 243 ++++++++--------
 tests/docker/dockerfiles/fedora.docker        | 262 ++++++++++--------
 tests/docker/dockerfiles/opensuse-leap.docker | 245 ++++++++--------
 tests/docker/dockerfiles/ubuntu.docker        |  71 -----
 tests/docker/dockerfiles/ubuntu1804.docker    | 255 +++++++++--------
 tests/docker/dockerfiles/ubuntu2004.docker    | 257 +++++++++--------
 tests/lcitool/Makefile.include                |  17 ++
 tests/lcitool/libvirt-ci                      |   1 +
 tests/lcitool/projects/qemu.yml               | 115 ++++++++
 tests/lcitool/refresh                         |  96 +++++++
 ui/clipboard.c                                |   3 +-
 ui/spice-display.c                            |  11 +
 25 files changed, 1217 insertions(+), 717 deletions(-)
 delete mode 100644 tests/docker/dockerfiles/ubuntu.docker
 create mode 100644 tests/lcitool/Makefile.include
 create mode 160000 tests/lcitool/libvirt-ci
 create mode 100644 tests/lcitool/projects/qemu.yml
 create mode 100755 tests/lcitool/refresh

-- 
2.33.1



Re: [PATCH v4 00/18] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles
Posted by Daniel P. Berrangé 2 years, 4 months ago
On Wed, Nov 24, 2021 at 01:01:32PM +0000, Daniel P. Berrangé wrote:
> One unsolved problem here is that the rebase to Fedora 35 has
> caused the oss-fuzz job in CI to reliably fail with a timeout.
> Running locally on F35 the fuzz script never finishes even after
> 24 hours. There's a genuine problem hiding in there in the
> tests or code itself, that newer clang has likely exposed.

Well something has changed in the last month - either Fedora 35
got some fixes or something in QEMU got fixed. The oss-fuzz
jobs now pass on Fedora 35 reliably both locally and in CI.


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