Skip to content

Replace the templates with a "cbuild" bash script

Peter Hutterer requested to merge whot/ci-templates:wip/cbuild-scripts into master

This sits on top of !94 (merged)

Over time, the infrastructure for the templates has changed a fair bit. We are now at the point where all .fdo.container-build images are built on the same base image and all .fdo.qemu-build images on another image.

At the same time, the templates have grown to be quite confusing and they are virtually impossible to reproduce without the GitLab CI infrastructure. All commands are within script: tags and only come together when run on the CI. This makes debugging time-consuming and the convoluted approach makes extending it hard.

Since we control the image everything is built from, we can have the command to build an image on that image itself. This patch replaces the current build templates with a bash script that does either a normal or a quemu supported build. This bootstrap/cbuild script can be run locally and debugged locally too. This reduces the actual template to just a single line.

This is a single massive patch because there are few in-between stages. To just lift the script: tags out of the yaml file into a functioning bash script already required some changes, making that bash script less horrible required more. It's less effort to review the final script than it would be to review a patchset to go from one to the other.

Notable changes in behaviour, primarily because we want this to be run by a local user without messing up the host too much:

  • /etc/container/storage.conf is only written if run as root, otherwise we rely on the right configuration
  • variables are filled in from the environment when the CI_* equivalents are missing
  • It's a single file without Jinja processing, so the various packaging commands are set up during startup depending on the requested distribution name.
  • FDO_CI_TEMPLATES_QEMU_BASE_IMAGE is now required for a qemu build, otherwise the shell script doesn't know where to fetch the base image from.
  • dropped Ubuntu versions prior to 16.04 because... too niche. If they're needed, we can just re-add them.

Merge request reports