Projects built on image-garden
four components, one action for everyone
Five projects put image-garden into CI. Four GitLab CI components build on the image-garden container to pack snaps, rocks and charms in a throwaway VM or to run spread; image-garden-action installs the snap on GitHub runners and runs spread. All of them rely on the same few commands and on pkgproxy as their cache.
On the map: built on it
▶ Watch this deck — 5 scenes, ~4 min
Worth seeing first
- The adhoc backend: allocate and discard — the spread backend all of them start from
01 The same machines in CI
Five projects run image-garden in CI: four GitLab CI components on the container, one GitHub action on the snap.
Say your spread tests pass on your laptop, on a garden VM of Debian and one of Fedora. Sooner or later you want them to run on every merge request too, on a machine you don't sit at. That machine needs image-garden, QEMU, a way to reach KVM, and somewhere to keep downloads. Five small projects do that wiring for you, so a CI job is a few lines of configuration. Four of them are GitLab CI components built on the image-garden container. One is a GitHub action built on the snap. This deck is the map of the five.
Details and sources
Details
- image-garden needs
/dev/kvmfor full speed; without it QEMU emulates the CPU, many times slower. GitLab.com's hosted runners do not give jobs/dev/kvm, so image-garden jobs, and every job built on it, run on runners of your own that pass the device in (README.md:778-787). - The five projects and the commits this map read: snapcraft-gitlab-ci
91b5e29, rockcraft-gitlab-cie8fd725, charmcraft-gitlab-ci6fc8543, spread-gitlab-ci3d522d4, image-garden-action2891c7a(integrations.commits in this map's repository). - Debian and Fedora are an example of two systems, not something the projects require.
Read more
02 Four components on the container
snapcraft-, rockcraft- and charmcraft-gitlab-ci pack in a throwaway VM; spread-gitlab-ci runs your spread.yaml. Each image is built FROM the image-garden container.
On GitLab, a job runs inside a container image, so these four start from image-garden's own container and add a little. Three of them build packages. snapcraft, rockcraft and charmcraft GitLab CI each start a throwaway Ubuntu VM that matches what they build for, copy your project in, pack a snap, a rock or a charm inside it, and copy the result back out. The fourth, spread GitLab CI, adds spread and a reporter, then runs your own spread.yaml and shows the results the way GitLab can. All four need runners that give the job KVM.
Details and sources
Details
- Each image starts from image-garden's container:
FROM registry.gitlab.com/zygoon/image-garden:v0.7.2in snapcraft-gitlab-ci (snapcraft-gitlab-ci Dockerfile:9), rockcraft-gitlab-ci (rockcraft-gitlab-ci Dockerfile:9) and charmcraft-gitlab-ci (charmcraft-gitlab-ci Dockerfile:15); spread-gitlab-ci still starts fromv0.7.0(spread-gitlab-ci Dockerfile:20). - Known discrepancy: spread-gitlab-ci builds on an older image-garden. None of the four uses v0.8.0 yet.
- The craft images add the ssh client, sshpass and their
*craft-vmscript; charmcraft-gitlab-ci also bundles charmcraft and skopeo for publishing. spread-gitlab-ci adds checksum-pinned spread, spread-plus and spread-gitlab-report, which turns spread's output into JUnit and annotations for GitLab (spread-gitlab-ci Dockerfile:22-51). - The craft scripts start the VM with
image-garden allocate --spread, copy the project in with tar over ssh, runpack --destructive-modeinside, and copy the result back (snapcraft-gitlab-cibin/snapcraft-vm).
Read more
03 One action on the snap
image-garden-action installs snapd, pkgproxy and the image-garden snap on the GitHub runner, then runs the snap's spread on one garden system.
GitHub works the other way round. A job runs on a whole virtual machine, not in a container you choose, so the GitHub action installs things on that runner instead. It installs snapd, the pkgproxy snap and the image-garden snap, connects them, and then runs the spread that the snap carries. Your workflow names one garden system per job, and the action makes its image and runs your tests on it. Nothing to build, and no image of your own to keep up to date: the snap store and the action's version pick what you get.
Details and sources
Details
- The action is a composite action that installs image-garden and uses the bundled copy of spread (image-garden-action action.yaml:5-7).
- It installs or refreshes snapd and installs the pkgproxy snap (image-garden-action action.yaml:209-232), installs the image-garden snap (image-garden-action action.yaml:370-375), connects the two (image-garden-action action.yaml:376-393) and aliases
image-garden.spreadasspread(image-garden-action action.yaml:394-397). garden-systemis its only required input (image-garden-action action.yaml:42-44).- The channels of the three snaps are inputs, by default
latest/stable(image-garden-action action.yaml:9-17).
Read more
05 Where to go from here
Next: spread-gitlab-ci, image-garden-action, the craft components, the contract, pkgproxy and KVM runners.
That's the family: four components on the container for GitLab, one action on the snap for GitHub, and the same allocate, query and discard underneath. If you run spread, go to spread GitLab CI or to the GitHub action next. If you pack snaps, rocks or charms, the craft deck shows the throwaway VM in detail. The contract deck lists exactly what these projects expect from image-garden. And whichever you pick, read why pkgproxy matters in CI, and how to get runners with KVM.
Details and sources
Roads from here
BUILT ON IT · CI integrations
- spread-gitlab-ci — spread on GitLab, in the image-garden container
- image-garden-action for GitHub — spread on GitHub, with the snap
- Building snaps, rocks and charms in a VM — how the craft components pack in a VM
- What the integrations rely on — the commands and outputs they all rely on
PKGPROXY · caching for guests
- What pkgproxy gives a garden — why pkgproxy is the only cache they keep
CONTAINER · OCI image
- Running the container in CI — runners that give jobs /dev/kvm