qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Willian Rampazzo" <willianr@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH v4 00/22] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles
Date: Wed, 23 Jun 2021 15:22:23 +0100	[thread overview]
Message-ID: <20210623142245.307776-1-berrange@redhat.com> (raw)

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, since that is also 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 has to have its list of pre-requisites enumerated

   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 distros
are Debian (10, sid), Ubuntu (18.04, 20.04), CentOS (8, 8 Stream),
Fedora (32, 33, rawhide), OpenSUSE Leap (15.2) macOS (HomeBrew),
FreeBSD w/ Ports (11, 12, current).

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

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 we 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 could enhance lcitool to support layered containers for cross-builds,
but before doing that I wondered how strongly people are attached to
them ? If self-contained dockerfiles are acceptable I can do that more
easily.

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

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 tests/docker/dockerfiles/refresh script that needs
to be invoked periodically to re-generate them. eg when adding a
new distro, or when the package lists change. Whomever runs this
needs to have a checkout of libvirt-ci.git. I previously used a
git submodule, but this causes chicken and egg problems with updates.
libvirt-ci won't want to take merge changes unless QEMU maintainers
have accepted the new series, but the new series needs the libvirt-ci
changes merged to update the submodule hash. Avoiding git submodules
eliminates this problem.

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é (22):
  hw/usb/ccid: remove references to NSS
  tests/docker: don't use BUILDKIT in GitLab either
  tests/docker: use project specific container registries
  tests/docker: use explicit docker.io registry
  tests/docker: remove FEATURES env var from templates
  tests/docker: fix sorting in package lists
  tests/docker: fix mistakes in centos package lists
  tests/docker: fix mistakes in fedora package list
  tests/docker: fix mistakes in ubuntu package lists
  tests/docker: remove mingw packages from Fedora
  tests/docker: expand centos8 package list
  tests/docker: expand fedora package list
  tests/docker: expand ubuntu1804 package list
  tests/docker: expand ubuntu2004 package list
  tests/docker: expand opensuse-leap package list
  tests/docker: add script for automating container refresh
  tests/docker: auto-generate centos8 with lcitool
  tests/docker: auto-generate fedora with lcitool
  tests/docker: auto-generate ubuntu1804 with lcitool
  tests/docker: auto-generate ubuntu2004 with lcitool
  tests/docker: auto-generate opensuse-leap with lcitool
  tests/docker: remove ubuntu container

 .gitlab-ci.d/containers.yml                   |   5 -
 .travis.yml                                   |  12 +-
 docs/ccid.txt                                 |  15 +-
 docs/devel/testing.rst                        |  34 ++-
 scripts/coverity-scan/coverity-scan.docker    |   1 -
 tests/docker/Makefile.include                 |  12 +
 tests/docker/common.rc                        |  19 +-
 tests/docker/docker.py                        |   4 +-
 tests/docker/dockerfiles-refresh.py           |  70 +++++
 tests/docker/dockerfiles/centos8.docker       | 170 +++++++++---
 .../dockerfiles/debian-xtensa-cross.docker    |   2 +-
 tests/docker/dockerfiles/debian10.docker      |   4 +-
 tests/docker/dockerfiles/debian11.docker      |   2 +-
 .../dockerfiles/fedora-cris-cross.docker      |   2 +-
 .../dockerfiles/fedora-i386-cross.docker      |   2 +-
 .../dockerfiles/fedora-win32-cross.docker     |   3 +-
 .../dockerfiles/fedora-win64-cross.docker     |   3 +-
 tests/docker/dockerfiles/fedora.docker        | 259 ++++++++++--------
 tests/docker/dockerfiles/opensuse-leap.docker | 184 +++++++++----
 tests/docker/dockerfiles/ubuntu.docker        |  73 -----
 tests/docker/dockerfiles/ubuntu1804.docker    | 199 ++++++++++----
 tests/docker/dockerfiles/ubuntu2004.docker    | 215 ++++++++++-----
 tests/docker/run                              |   3 -
 tests/docker/test-clang                       |   2 +-
 tests/docker/test-debug                       |   2 +-
 tests/docker/test-mingw                       |   3 +-
 tests/docker/test-misc                        |   2 +-
 tests/docker/test-tsan                        |   2 +-
 28 files changed, 840 insertions(+), 464 deletions(-)
 create mode 100755 tests/docker/dockerfiles-refresh.py
 delete mode 100644 tests/docker/dockerfiles/ubuntu.docker

-- 
2.31.1




             reply	other threads:[~2021-06-23 14:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 14:22 Daniel P. Berrangé [this message]
2021-06-23 14:22 ` [PATCH v4 01/22] hw/usb/ccid: remove references to NSS Daniel P. Berrangé
2021-06-25 18:11   ` Willian Rampazzo
2021-07-05 10:37   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 02/22] tests/docker: don't use BUILDKIT in GitLab either Daniel P. Berrangé
2021-06-25 20:21   ` Willian Rampazzo
2021-06-23 14:22 ` [PATCH v4 03/22] tests/docker: use project specific container registries Daniel P. Berrangé
2021-06-25 20:24   ` Willian Rampazzo
2021-07-05 12:07   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 04/22] tests/docker: use explicit docker.io registry Daniel P. Berrangé
2021-07-05 13:33   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 05/22] tests/docker: remove FEATURES env var from templates Daniel P. Berrangé
2021-06-25 20:51   ` Willian Rampazzo
2021-07-05 12:20   ` Alex Bennée
2021-07-05 12:36   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 06/22] tests/docker: fix sorting in package lists Daniel P. Berrangé
2021-07-05 13:33   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 07/22] tests/docker: fix mistakes in centos " Daniel P. Berrangé
2021-07-05 13:33   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 08/22] tests/docker: fix mistakes in fedora package list Daniel P. Berrangé
2021-07-05 13:36   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 09/22] tests/docker: fix mistakes in ubuntu package lists Daniel P. Berrangé
2021-07-05 13:40   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 10/22] tests/docker: remove mingw packages from Fedora Daniel P. Berrangé
2021-07-05 13:40   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 11/22] tests/docker: expand centos8 package list Daniel P. Berrangé
2021-07-05 13:40   ` Alex Bennée
2021-07-05 20:27   ` Alex Bennée
2021-07-05 21:41     ` Daniel P. Berrangé
2021-07-05 21:45       ` Daniel P. Berrangé
2021-07-06  8:20         ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 12/22] tests/docker: expand fedora " Daniel P. Berrangé
2021-07-05 13:41   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 13/22] tests/docker: expand ubuntu1804 " Daniel P. Berrangé
2021-07-05 13:41   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 14/22] tests/docker: expand ubuntu2004 " Daniel P. Berrangé
2021-07-05 13:42   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 15/22] tests/docker: expand opensuse-leap " Daniel P. Berrangé
2021-07-05 13:42   ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 16/22] tests/docker: add script for automating container refresh Daniel P. Berrangé
2021-07-05 13:44   ` Alex Bennée
2021-07-05 14:56     ` Daniel P. Berrangé
2021-07-05 15:26       ` Alex Bennée
2021-06-23 14:22 ` [PATCH v4 17/22] tests/docker: auto-generate centos8 with lcitool Daniel P. Berrangé
2021-06-23 14:22 ` [PATCH v4 18/22] tests/docker: auto-generate fedora " Daniel P. Berrangé
2021-06-23 14:22 ` [PATCH v4 19/22] tests/docker: auto-generate ubuntu1804 " Daniel P. Berrangé
2021-06-23 14:22 ` [PATCH v4 20/22] tests/docker: auto-generate ubuntu2004 " Daniel P. Berrangé
2021-06-23 14:28 ` [PATCH v4 21/22] tests/docker: auto-generate opensuse-leap " Daniel P. Berrangé
2021-06-23 14:29 ` [PATCH v4 22/22] tests/docker: remove ubuntu container Daniel P. Berrangé
2021-06-23 14:42 ` [PATCH v4 00/22] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles no-reply
2021-07-05 14:51 ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210623142245.307776-1-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=willianr@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).