gitlab ci: containerize the CI
This is 90% copied from libinput's .gitlab-ci.yml
The idea here is that we have an image with all the dependencies installed, so we don't need to run apt/dnf/... on every build step. The images are re-generated once they're older than 7 days but can also be manually regenerated.
libinput uses this to build on various distributions, the hooks here are the same. right now everything is debian stretch, but new ones can be added easily. likewise, adding meson args etc is easy (see libinput) so you can try the various -Dfoo
and check they still build.
Components:
- a bootstrap image which is the quick and minimal one to check for a container's age in the registry.
- a check stage to tag outdated images (leaving a
.img_ready
file if new enough) - a clean stage to remove leftover ones from the registry
- a prep stage to regenerate an image (if the
.img_ready
file isn't present from the previous stage) - the actual build stages which do the same as before
A successful run is here, this one will fail because it requires bootstrapping in the weston repo.
This needs bootstrapping and setup.
Setup
- Go to your profile's Personal Access Token page and create a token with full access
- copy the token value and set it as
PERSONAL_TOKEN_<username>
in weston's CI/CD Settings Environment Variables
You're now good to go for the CI to access the registry when you push.
This needs to be done by everyone who wants to be able to rebuild images.
Bootstrapping
You want the pipeline to succeed before merging, so the best is:
- take the branch locally
- in the .gitlab-ci, replace the
image
line to grab the initial one from libinput
bootstrap:
stage: bootstrapping
when: manual
image: $CI_REGISTRY/libinput/libinput/containers:latest
- push it to weston's real repository as a branch
- manually trigger the bootstrap job, wait until complete
- git reset the libinput change, re-push the branch
- now that the bootstrap image exists, all the other ones should start building. worst case manually trigger the
force-container-prep
- delete the branch
- re-trigger the pipeline for this merge request
- dance and party at the sight of a successful pipeline
Alternatively, give me access to the weston repo and I can do all the above to get this sorted for merging :)