ci: CI and image publishing for release branches
Merged
JE
4d ago+75+75+01234567890123456789-13-13-01234567890123456789
Description
Preparing for release branches (release-1.9, release-1.10, for the eMudhra CA fix in the images kubevela
1.10/1.11 and 1.12 use), four small CI changes:
- CI on release branches:
ci.yamlruns on pushes and PRs torelease-*too, so backport PRs get the unit
tests and both kind e2e jobs. latestis the newest release:docker/metadata-actionaddslatestfor every tag by default
(latest=autowithtype=ref,event=tag), andmasterpushes set it too (enable={{is_default_branch}}),
solatestfollows whatever was built last. Nowlatestis set only after a tag's image is pushed, and
only if the tag is the highestvX.Y.Zin the repository (git ls-remote,sort -V): pre-release tags,
patches on an older line and branch pushes (mastergets:master) don't move it. Checking after the
push means a build that finishes after a newer tag was pushed doesn't move it back.- One publisher for
oamdev/cluster-gateway:<tag>: today bothbuild-image.yml(multi-arch buildx, Docker
Hub + GHCR) andgo-release.yml(per-archdocker build+docker manifest, Docker Hub) push it, and
whichever finishes last wins.go-release.ymlnow builds and publishes only the addon-manager (and the
release with the charts).oamdev/cluster-gateway:<tag>-amd64/-arm64are no longer pushed;<tag>
itself is multi-arch. docker manifestworks again: current runners attach a provenance attestation todocker buildoutput,
so each per-arch tag is a manifest list anddocker manifest createfails ("is a manifest list"), which
also skips thereleasejob.BUILDX_NO_DEFAULT_ATTESTATIONS=1on the per-arch job keeps plain images, and
the existingannotate --archkeeps setting the platform (the arm64 image is built on an amd64 runner).- An immutable tag for branch builds: a push (or manual run) on
master/release-*publishes
:<branch>-<sha>next to the moving:<branch>, so a release candidate can be scanned and tested by a tag
that won't change before the release is tagged. - Manual image builds only on
masterandrelease-*: pushes were already limited to those branches, but
a manual run could build and publish any branch. BuildImage now fails a manual run on any other branch in its
first step (as terraform-controller's BuildImage does). - Codecov upload errors fail runs that have a token (
fail_ci_if_error: ${{ secrets.CODECOV_TOKEN != '' }}):
pushes and same-repo PRs; PRs from forks get no secrets, so their uploads stay non-blocking. The CLI is
installed from its default, verified download (use_pypiremoved). - The release waits for the gateway image: with (3) the image comes from
build-image.yml's own run, so the
releasejob waits untiloamdev/cluster-gateway:<tag>exists before publishing (up to 30 minutes).
I have:
- Signed off the commits (DCO).
- Run
actionlinton the changed workflows. - Run them on my fork (below).
How has this been tested
On my fork, with the images redirected to my GHCR and branches set up as they will be here (release-1.9 at
2b04dd4, release-1.10 at f1e00d9, these commits cherry-picked):
| Check | Result |
|---|---|
CI on a push to release-1.9 / release-1.10 | green (unit tests, gateway e2e, OCM addon e2e) |
CI on a PR into release-1.9 | runs, green |
| BuildImage, push / manual run on a branch | :<branch> and :<branch>-<sha> (same image) |
| BuildImage, push to a release branch or the default branch | no latest |
BuildImage, tags v1.9.2, v1.10.0-alpha.1, v1.10.0, v1.9.3 in turn | latest → v1.9.2; stays; → v1.10.0; stays |
| BuildImage, manual run on another branch | fails at the first step; nothing pushed |
| CI, codecov step (fork, no token) | CLI verified ("Good signature", "codecov: OK"); upload fails, run stays green |
GoRelease, tag v1.10.0-alpha.1 | the release job waited ~16 min and published 19 s after BuildImage pushed the image |
GoRelease, tag v1.9.2 | all jobs green; addon-manager v1.9.2 for amd64 + arm64; no cluster-gateway push; GitHub release with the charts. Without commit 4, image-manifest fails with "is a manifest list" |
Special notes for your reviewer
Once merged, latest stays on today's master build until the first stable tag (v1.9.2).
For release-1.9 (cut at 2b04dd4) I'll also cherry-pick 284a2e9 ("make codecov upload non-blocking in
forks"): without it, CI on PRs from forks fails at the codecov upload (no token). release-1.10 already has it.
Summary by cubic
Prepares CI and image publishing for the upcoming release-1.9 and release-1.10 branches.
- Runs CI on pushes and PRs to
release-*branches, so backports get the unit tests and both kind e2e jobs. latestonly moves to the newest stablevX.Y.Ztag; branch builds also get an immutable<branch>-<sha>tag.- Makes
build-image.ymlthe sole publisher ofoamdev/cluster-gateway:<tag>, which is now multi-arch only;go-release.ymlpublishes just the addon-manager and waits for the cluster-gateway image before cutting the release (authenticated with Docker Hub so the polling isn't rate-limited). - Forces plain per-arch images (
BUILDX_NO_DEFAULT_ATTESTATIONS=1) sodocker manifest createno longer fails on buildx's manifest-list attestations. - Restricts manual image builds to
masterandrelease-*branches. - Fails the codecov upload only when a token is present (fork PRs have none) and pins the codecov CLI to its verified download.