Acceptance testing using distro Puppet versions Edit

Published on Oct 25, 2023 by ekohl.

Vox Pupuli’s CI now supports testing using distro Puppet versions. At the moment this is used for ArchLinux, Debian 12 and Fedora 37 & 38.

Within Vox Pupuli we maintain a lot of modules. Keeping those healthy is a challenge and having working acceptance tests makes that feasible. For each operating system we need two things: a working (container) image and Puppet. The former is generally easy (except for operating systems with licenses), but for the latter we need some system packages. Until recently we’ve relied on Puppet’s RPM and deb packages. This matches how most people consume Puppet, but Puppet’s coverage of operating systems is incomplete. There are no packages for Archlinux and for the distributions that are supported, it doesn’t have complete coverage. Now our tooling is enhanced to use the distribution’s native packages. With this in place, it’s possible to start supporting the recently released Debian 12.

It’s also a good chance to dive a bit deeper in how this is done. Back in February I gave a talk on this, but there was a lot of information in there and written form may be useful. I’m not going to cover everything from my talk, but only focus on the acceptance test implementation. It heavily relies on dynamically generated matrices in GitHub Actions, which I’ve written about before. To generate this matrix, puppet_metadata is used.

How does puppet_metadata generate this matrix? It parses metadata.json and builds a list of supported operating systems. For every operating system it iterates the OS releases (except for rolling releases like Archlinux and Gentoo). For each release, it iterates the supported Puppet versions (also derived from metadata.json) and checks if it can find a Puppet version. If there’s an AIO (all-in-one) build (determined using PuppetMetadata::AIO) then that’s preferred.

This gives us a list like:

  • Archlinux rolling - Distro Puppet
  • Debian 11 - Puppet 7
  • Debian 11 - Puppet 8
  • Debian 12 - Distro Puppet 7
  • CentOS 8 - Puppet 7
  • CentOS 8 - Puppet 8

This is exported as a list of environment variables that gha-puppet can use in the Beaker workflow. Note you need to be on v2 for this. In the setup_matrix job the matrix is generated by calling metadata2gha (from puppet_metadata) and used in the acceptance job.

With all of this in place, how do you add support for a new Puppet version or a new OS version? Simply modify metadata.json and add Debian 12. It should now show up in the testing matrix.

As for unit tests, rspec-puppet-facts and FacterDB provide similar functionality that relies on metadata.json.

Once Puppet will support Debian 12, we will switch the OS testing to the official packages but it’s now possible to move forward faster.