ci: CI and image publishing for release branches

Merged
JE
4d ago
+75-13

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:

  1. CI on release branches: ci.yaml runs on pushes and PRs to release-* too, so backport PRs get the unit
    tests and both kind e2e jobs.
  2. latest is the newest release: docker/metadata-action adds latest for every tag by default
    (latest=auto with type=ref,event=tag), and master pushes set it too (enable={{is_default_branch}}),
    so latest follows whatever was built last. Now latest is set only after a tag's image is pushed, and
    only if the tag is the highest vX.Y.Z in the repository (git ls-remote, sort -V): pre-release tags,
    patches on an older line and branch pushes (master gets :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.
  3. One publisher for oamdev/cluster-gateway:<tag>: today both build-image.yml (multi-arch buildx, Docker
    Hub + GHCR) and go-release.yml (per-arch docker build + docker manifest, Docker Hub) push it, and
    whichever finishes last wins. go-release.yml now builds and publishes only the addon-manager (and the
    release with the charts). oamdev/cluster-gateway:<tag>-amd64 / -arm64 are no longer pushed; <tag>
    itself is multi-arch.
  4. docker manifest works again: current runners attach a provenance attestation to docker build output,
    so each per-arch tag is a manifest list and docker manifest create fails ("is a manifest list"), which
    also skips the release job. BUILDX_NO_DEFAULT_ATTESTATIONS=1 on the per-arch job keeps plain images, and
    the existing annotate --arch keeps setting the platform (the arm64 image is built on an amd64 runner).
  5. 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.
  6. Manual image builds only on master and release-*: 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).
  7. 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_pypi removed).
  8. The release waits for the gateway image: with (3) the image comes from build-image.yml's own run, so the
    release job waits until oamdev/cluster-gateway:<tag> exists before publishing (up to 30 minutes).

I have:

  • Signed off the commits (DCO).
  • Run actionlint on 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):

CheckResult
CI on a push to release-1.9 / release-1.10green (unit tests, gateway e2e, OCM addon e2e)
CI on a PR into release-1.9runs, green
BuildImage, push / manual run on a branch:<branch> and :<branch>-<sha> (same image)
BuildImage, push to a release branch or the default branchno latest
BuildImage, tags v1.9.2, v1.10.0-alpha.1, v1.10.0, v1.9.3 in turnlatest → v1.9.2; stays; → v1.10.0; stays
BuildImage, manual run on another branchfails 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.1the release job waited ~16 min and published 19 s after BuildImage pushed the image
GoRelease, tag v1.9.2all 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.
  • latest only moves to the newest stable vX.Y.Z tag; branch builds also get an immutable <branch>-<sha> tag.
  • Makes build-image.yml the sole publisher of oamdev/cluster-gateway:<tag>, which is now multi-arch only; go-release.yml publishes 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) so docker manifest create no longer fails on buildx's manifest-list attestations.
  • Restricts manual image builds to master and release-* branches.
  • Fails the codecov upload only when a token is present (fork PRs have none) and pins the codecov CLI to its verified download.