CI/CD
The pipeline (.gitlab-ci.yml) runs for merge requests and tags only, on runners tagged korner-kind.
Dependencies
Every dependency is public, so jobs need no credentials to fetch them:
| Project | Used as |
|---|---|
gitlab.com/kornercloud.dev/genop-runtime | Go module (go.mod) |
gitlab.com/kornercloud.dev/ci-components | CI/CD components (include: component:), pinned to a release tag |
github.com/imfing/hextra | Documentation site theme, a submodule of site/ pinned to a release commit |
What runs when
- Merge requests: lint, tests, builds and scans. The image jobs build both images but never push them. The end-to-end run is started by hand, see below.
- Version tags (
v0.1.0,v0.1.0-rc.1): the same jobs. The images are pushed as<image>:<tag>and<image>:<short commit SHA>, plus<image>:latestunless the tag is a pre-release, and the chart is pushed to the OCI registry. Then, for each image’s pushed digest: a Trivy scan (a fixable CRITICAL vulnerability stops the release), an SBOM, and the end-to-end suite against the pushed images. Only when all of them pass is each image given a keyless cosign signature with the SBOM attached. The GitLab release is created last, listing the digests. See release verification.
End-to-end tests
The suite (see End-to-end tests) runs
in a vcluster that the job creates in korner-kind’s ci-vcluster namespace
as its ServiceAccount, e2e-<pipeline ID>, and deletes in after_script.
korner-kind runs one CI vcluster at a time, so the e2e jobs share the
resource group e2e-vcluster and wait for each other.
On a merge request, a maintainer starts e2e:images after reading the
change. It is the only job of a merge request pipeline that pushes: the
images under test, as $CI_REGISTRY_IMAGE/e2e/<image>:e2e-<short commit SHA>, never to the release images. test:e2e then runs the suite with
them. Both are optional: a merge request pipeline passes without them.
On a version tag, test:e2e:release runs the suite with the release
images, and signing and the release wait for it. The GPU case never runs in
CI.
The images are private until the project is, so the suite gives the
vcluster a pull secret. The vcluster syncs it to ci-vcluster, where every
CI job can read it, so it holds the project’s deploy token named
gitlab-deploy-token, with only the read_registry scope, which GitLab
passes to jobs as CI_DEPLOY_USER and CI_DEPLOY_PASSWORD. The job token
would let any of those jobs push over the release images. Without the
deploy token, the e2e jobs stop before creating the vcluster.
hack/check_ci.py (job check:ci) keeps these rules from drifting: pipelines for merge requests and tags only, release jobs on version tags only and in this order, images named by digest, pinned job images, verification patterns that reject lookalike projects, and the end-to-end jobs: e2e:images alone pushes from a merge request, by hand, to e2e/ with e2e- tags, the e2e jobs share their resource group, and they pass the deploy token, never the job token.
Tags are protected, so only maintainers can start a release.
Documentation
Every pipeline checks the documentation:
docs:verifyregenerates the reference pages (custom resources, operator flags) and fails if they differ from the committed ones; runmake docsand commit the result.docs:buildbuilds the site with Hugo, anddocs:linksfails on a broken internal link or a link left pointing at a.mdfile.
On a final version tag (v0.1.0, not v0.1.0-rc.1), pages publishes that build to https://code.kornercloud.dev. A release candidate never replaces the published docs. To republish, retry the pages job in the tag’s pipeline.
Merge requests from forks
Every job needs a runner tagged korner-kind, which forks do not have, so a merge request from a fork gets no pipeline of its own. A maintainer runs it in this project only after reading the whole change, including .gitlab-ci.yml, the Makefile, scripts and tests.