Repository navigation
ci: publish signed main builds of mecak8s, Studio, and their charts - #2292
Conversation
Nashon-Steffen
left a comment
There was a problem hiding this comment.
Multi-agent consensus review
Agents consulted: security and supply chain, CI/CD correctness, error handling and resilience, architecture and general quality, comment hygiene and docs. Codex cross-review did not complete.
Consensus summary
| # | Finding | Consensus | Severity | Action |
|---|---|---|---|---|
| 1 | A forced rollback can't cross a VERSION bump |
9/10 | MEDIUM | Fix |
| 2 | Charts can be selected before they're signed, and the guard treats them as published | 9/10 | MEDIUM | Fix |
| 3 | A failed last-published lookup blocks every publish, even with force |
8/10 | MEDIUM | Fix |
| 4 | The two charts can diverge; the comment and README say they can't | 8/10 | LOW | Fix |
| 5 | Dispatch publishes without checking that CI passed | 8/10 | LOW | Discuss |
| 6 | Move the resolve logic into a tested script | 7/10 | LOW | Discuss |
| 7 | A failed chart push hides helm's error | 7/10 | LOW | Fix |
| 8 | Pass the token through env, as L138 does |
8/10 | LOW | Fix |
| 9 | A pending dispatch can be cancelled by a later automatic run | 7/10 | LOW | Fix |
| 10 | mecak8s is tagged before it's verified and isn't scanned | 7/10 | LOW | Discuss |
| 11 | The README section repeats the workflow header | 8/10 | LOW | Fix |
| 12 | The "bump VERSION" advice describes an unsupported hand edit | 7/10 | LOW | Fix |
Overall
This adds a second publishing pipeline separate from releases. It builds, scans (Studio), signs, attests and verifies both images from a single main commit, then publishes digest-pinned charts as the point followers react to. The design holds up. Main builds get their own registry path and signing identity (continuous.yml@refs/heads/main), so they can never verify as a release. The workflow_run gate excludes forks and pull requests named main. Untrusted values go through env. Runs that can't publish get their own concurrency group. The newer-than-last-published guard, together with CI's own cancel-in-progress on main, keeps followers from moving backwards in normal operation. Both charts render repo@digest exactly as the grep -F checks expect, and the lint overrides match release.yml.
None of the findings block merging; they're about recovery paths. The forced-rollback promise fails silently across a release PR (1). A failure after the mecatl-studio chart push leaves an unsigned chart that the guard then treats as published (2). A single unresolvable lookup stops all publishing, and force can't override it (3). All three are in the resolve step, which is a good reason to move it into a tested script alongside release-tag-guard.sh (6). The rest are consistency and wording fixes.
Documentation
.github/workflows/README.mdL22-24: "always gets images from one commit" holds within one chart, not across both (finding 4)..github/workflows/README.mdL26-28 andcontinuous.ymlL29-32: rollback withforcedoesn't work across aVERSIONbump and lasts only until the next green merge (finding 1)..github/workflows/README.mdL12-34: repeats the workflow header on a page that calls itself an index (finding 11).
Generated with Claude Code
| minor=${rest%%.*} | ||
| patch=${rest#*.} | ||
| # The g prefix keeps an all-digit short SHA a valid semver identifier. | ||
| version="${major}.${minor}.$((patch + 1))-main.${RUN_NUMBER}.${RUN_ATTEMPT}.g$(printf '%s' "$sha" | cut -c1-8)" |
There was a problem hiding this comment.
A forced rollback can't cross a VERSION bump (9/10, MEDIUM; raised by CI/CD and resilience reviewers)
The base comes from the target commit's own VERSION, and release PRs bump VERSION on main (0.0.44 to 0.0.47 recently). A force dispatch of a commit from before the latest release PR gets 0.0.47-main.<higher run>…. That sorts below the current 0.0.48-main.<lower run>…, so Flux's >=0.0.0-0 range and helm show chart --devel keep the newer build. The run still reports success. The dispatch comment (L29-32) and README L27-28 say this rolls followers back.
Fix: take the base from the larger of VERSION at main HEAD and the target's VERSION, so the run number alone decides order. At minimum, fail when the computed version isn't greater than last_version. Also say in the README that a forced rollback lasts only until the next green merge, and that a lasting hold belongs in the Flux HelmRelease.
There was a problem hiding this comment.
Addressed in bfd5c6c: a forced older commit keeps at least the last publication's X.Y.Z, so a rollback across a VERSION bump still sorts first, and a run that wouldn't sort above the last publication fails. The README note that a rollback lasts only until the next main build (pin on the follower to hold) is in 41db157.
| cat push-output.txt | ||
| digest="$(awk '/^Digest:/ {print $2}' push-output.txt)" | ||
| case "$digest" in sha256:*) ;; *) echo "could not parse the ${chart} chart digest" >&2; exit 1;; esac | ||
| cosign sign --yes "${OCI_REGISTRY}/${chart}@${digest}" |
There was a problem hiding this comment.
Charts can be selected before they're signed or attested, and the guard counts them as published (9/10, MEDIUM; raised by security, CI/CD, resilience and comment-hygiene reviewers)
helm push creates the tag that Flux's range selects before this cosign sign and the two attest steps run. If signing or attesting the mecatl-studio chart fails, the newest chart has no signature or provenance. The next run, a dispatch, or "Re-run all jobs" then sees the commit as already published and ends with a notice. Only "Re-run failed jobs" repairs it, and that re-pushes the same version under a new digest. The comment at L136-137 and the README's dispatch advice don't cover this case.
Fix: in compute-version, run cosign verify and verify-attestation --type slsaprovenance1 on the latest mecatl-studio chart, and treat a failure as not published. Add a chart verify step after the attestations, as the image jobs have. On the infra side, set verify.provider: cosign with this identity on the OCIRepository, so Flux never reconciles an unsigned chart.
There was a problem hiding this comment.
Addressed in bfd5c6c and 42bd428. compute-version now verifies the last mecatl-studio chart's signature and provenance, and lets its commit publish again if either is missing. The chart job pushes, signs, attests, and verifies each chart before pushing the next. The README (41db157) asks followers to verify charts with the continuous.yml identity.
| last="" | ||
| if chart=$(helm show chart "oci://${OCI_REGISTRY}/mecatl-studio" --devel 2>&1); then | ||
| last_version=$(printf '%s\n' "$chart" | awk '/^version:/ {print $2}') | ||
| last=$(git rev-parse --verify --quiet "${last_version##*.g}^{commit}") || { |
There was a problem hiding this comment.
A failed last-published lookup blocks every publish, even with force (8/10, MEDIUM; raised by security, CI/CD and resilience reviewers)
This exits before the FORCE check at L153. The 8-character prefix can fail to resolve: it can be ambiguous across every ref fetched by fetch-depth: 0, the commit can be rewritten away, or the newest mecatl-studio tag can come from somewhere other than this workflow. When that happens, every later run fails, and the only way out is deleting GHCR package versions. The name unknown match at L147 behaves the same way: any other first-publish response, such as a 403 for a package that doesn't exist yet, fails with no override. The message "names no commit on main" also overstates the check, which only tests that the object exists.
Fix: record the full SHA in the chart (for example a Chart.yaml annotation set with yq before packaging) and read it back from helm show chart. When FORCE=true, downgrade lookup failures to a ::warning and continue with last="".
There was a problem hiding this comment.
Addressed in bfd5c6c: charts carry an org.opencontainers.image.revision annotation with the full commit, which the next run reads instead of resolving the short SHA. The off-main check now matches its message, and with force any lookup failure, including an unexpected registry response, is a warning instead of an error.
| # mecak8s first: Studio follows the daemon it talks to, so a failure | ||
| # between the two pushes leaves followers on a matching older Studio. |
There was a problem hiding this comment.
The two charts can diverge; this comment and the README say they can't (8/10, LOW; raised by comment-hygiene, resilience and security reviewers)
If the mecak8s push succeeds and the mecatl-studio push or signing fails, followers move to the new daemon while Studio stays on the previous build. That's the compatible direction, but it isn't "a matching older Studio". README L22-24 ("always gets images from one commit") holds within one chart only. Suggested wording:
| # mecak8s first: Studio follows the daemon it talks to, so a failure | |
| # between the two pushes leaves followers on a matching older Studio. | |
| # mecak8s first: Studio talks to the daemon, so a failure between the two | |
| # pushes leaves followers on the new daemon with the previous Studio. |
| else | ||
| # Provenance names the dispatched commit, so publish that commit | ||
| # unless another one is forced. | ||
| sha="${INPUT_SHA:-$GITHUB_SHA}" |
There was a problem hiding this comment.
Dispatch publishes without checking that CI passed (8/10, LOW; raised by security and resilience reviewers)
A workflow_run requires conclusion == 'success'. A dispatch publishes GITHUB_SHA anyway, even if its push CI is still running or has failed, and moves every follower to it under the same signing identity. The README suggests a dispatch after transient registry failures, which is when this check would matter.
Possible fix: unless force is set, require a successful push-event CI run for $sha, for example gh run list --workflow ci.yml --commit "$sha" --event push --status success --json databaseId --jq length. This needs actions: read. Alternatively, document that a dispatch skips the CI gate on purpose.
There was a problem hiding this comment.
Addressed in bfd5c6c: a dispatch without force requires a successful push CI run on its commit. Force skips the check, because CI cancels superseded main runs and an older rollback target often has no successful run.
| id: push | ||
| run: | | ||
| set -euo pipefail | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin |
There was a problem hiding this comment.
Pass the token through env, as L138 does (8/10, LOW; raised by security and architecture reviewers)
This isn't exploitable: the secret is masked, and github.actor can't carry shell metacharacters. But the file now does the same login two ways, and the L138 form is the safer one. Add GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} to this step's env and use printf '%s' "$GH_TOKEN" | helm registry login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin.
|
|
||
| permissions: {} | ||
|
|
||
| # One publication at a time, in order. A burst of merges collapses into at most |
There was a problem hiding this comment.
A pending dispatch can be cancelled by a later automatic run (7/10, LOW; raised by CI/CD and comment-hygiene reviewers)
With cancel-in-progress: false, a newer pending run in continuous-main cancels the older pending one. For automatic runs that's intended. Intermediate commits are skipped and show as cancelled runs, so it's worth saying so here. But a force rollback dispatched while a publish is running is silently dropped if any main CI run finishes first. Mention in the README to dispatch when nothing is publishing and to confirm the result.
There was a problem hiding this comment.
Addressed in 41db157: the concurrency comment says a newer pending run replaces an older one, pending dispatches included, and the README says to dispatch while nothing is running and check that it published.
| id: build | ||
| run: | | ||
| set -euo pipefail | ||
| ko build \ |
There was a problem hiding this comment.
mecak8s is tagged before it's verified and isn't scanned (7/10, LOW; raised by security, comment-hygiene and architecture reviewers)
ko build -t creates main/mecak8s:v<version> before signing. Studio, by contrast, is pushed by digest and tagged only after verification. mecak8s also skips the fixable-critical scan that Studio gets. Followers reach the image only by digest through the chart, and release.yml has the same shape, so this is mainly consistency. Either push by digest and tag after verifying, or add a short comment here explaining the difference. Consider adding the same anchore scan as well.
There was a problem hiding this comment.
Addressed in 42bd428: mecak8s gets the same fixable-critical scan as Studio before signing, and a comment explains that ko tags it before the scan and that followers reach it only by the chart's verified digest.
| - [Mecatequi CI adoption](../../user-docs/building/ci/mecatequi.md) | ||
| - [microVM environment operations](../../user-docs/operating/microvm-environments.md) | ||
|
|
||
| ## Continuous builds from main |
There was a problem hiding this comment.
This section repeats the workflow header (8/10, LOW; raised by comment-hygiene and architecture reviewers)
The page calls itself "only a stable index" with the YAML as the source of truth. This section restates most of continuous.yml L1-21: the version format, paths, publish order, guard and identity. The two copies already differ, for example on the "one commit" claim. Keep what an operator acts on: package paths, the cosign verify identity, visibility, and when to dispatch or use force. Leave the mechanics in the header.
| # main/charts), versioned X.Y.(Z+1)-main.<run>.<attempt>.g<sha8> from the | ||
| # commit's VERSION: the patch bump sorts them above the last release, and the | ||
| # run number and attempt order them by publication. Renaming this file resets | ||
| # the run number, so bump VERSION alongside such a rename. Images are tagged |
There was a problem hiding this comment.
The "bump VERSION" advice describes an unsupported hand edit (7/10, LOW; raised by comment-hygiene reviewer)
VERSION changes only through the Create Release PR flow, and Create Release Tag runs on a VERSION change. Suggested wording:
| # the run number, so bump VERSION alongside such a rename. Images are tagged | |
| # the run number, so cut a release (which bumps VERSION) alongside such a | |
| # rename. Images are tagged |
Move the compute-version decision logic into .github/scripts/resolve-main-build.sh with a test in task lint:actions. The chart now records its full commit in an org.opencontainers.image.revision annotation, which the next run reads instead of resolving the short SHA from the version. - A forced older commit keeps at least the last publication's X.Y.Z, so a rollback across a release's VERSION bump still sorts first; a run that would not sort above the last publication fails. - With force, a failed lookup of the last publication warns instead of blocking every run; the off-main check now matches its message. - A dispatch without force requires a successful push CI run on its commit. - A last chart that this workflow did not sign and attest does not count as published, so its commit can publish again. Addresses #2292 review comments: - MEDIUM .github/workflows/continuous.yml:169 (4262353943): forced rollback can't cross a VERSION bump - MEDIUM .github/workflows/continuous.yml:501 (4262353950): unsigned last chart counted as published - MEDIUM .github/workflows/continuous.yml:142 (4262353954): failed lookup blocks every publish, even with force - LOW .github/workflows/continuous.yml:121 (4262353989): dispatch publishes without checking CI - LOW .github/workflows/continuous.yml:104 (4262354000): move the resolve logic into a tested script Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Followers can select a chart as soon as it is pushed. Push, sign, attest, and verify the mecak8s chart before pushing the mecatl-studio chart, then verify that one the same way, so a failure never leaves the next chart pushed behind an unverified one. - Show helm's output when a chart push fails. - Log in to the chart registry with the token from env, as compute-version does. - Scan the mecak8s image for fixable critical vulnerabilities before signing it, as Studio is, and explain why ko tags it before the scan. - Correct the comment on the push order: a failure between the two charts leaves the new daemon with the previous Studio. Addresses #2292 review comments: - MEDIUM .github/workflows/continuous.yml:501 (4262353950): charts selectable before they're signed or attested - LOW .github/workflows/continuous.yml:490 (4262353966): the two charts can diverge; comment said otherwise - LOW .github/workflows/continuous.yml:498 (4262354005): failed chart push hides helm's error - LOW .github/workflows/continuous.yml:495 (4262354014): pass the token through env - LOW .github/workflows/continuous.yml:233 (4262354042): mecak8s tagged before verification and not scanned Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The README section repeated the workflow header. Keep what an operator acts on there (packages, verification, publishing by hand, rollback, partial failures) and leave the version scheme and publication order in the header. Drop the claim that a follower always gets images from one commit, which a failure between the two chart pushes can break. In the workflow header, point a rename at a release instead of a hand edit of VERSION, and say that a newer pending run replaces an older one, including a pending dispatch. Addresses #2292 review comments: - LOW .github/workflows/continuous.yml:48 (4262354020): a pending dispatch can be cancelled by a later run - LOW .github/workflows/README.md:12 (4262354048): README section repeats the workflow header - LOW .github/workflows/continuous.yml:12 (4262354057): "bump VERSION" advice describes a hand edit Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Getting an OCI image of Studio or mecak8s needs a release today, so no environment can track main. Add a continuous build that runs after CI passes on a push to main and publishes the mecak8s and Studio images and the mecak8s and mecatl-studio charts under ghcr.io/<repo>/main/, all from one commit with one version, X.Y.(Z+1)-main.<run>.<attempt>.g<sha8>. Images are pushed, scanned (Studio), signed, SBOM- and provenance-attested, and verified against this workflow's identity before the charts publish; each chart pins its image by digest, so a follower using a prerelease range such as >=0.0.0-0 always gets images from one commit. A commit publishes only when it is newer on main than the last published chart, so followers never move back, and runs that cannot publish never displace a queued publication. Release artifacts, tags, and signing identities are untouched, and main builds ship without the product-metrics ingest key. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Move the compute-version decision logic into .github/scripts/resolve-main-build.sh with a test in task lint:actions. The chart now records its full commit in an org.opencontainers.image.revision annotation, which the next run reads instead of resolving the short SHA from the version. - A forced older commit keeps at least the last publication's X.Y.Z, so a rollback across a release's VERSION bump still sorts first; a run that would not sort above the last publication fails. - With force, a failed lookup of the last publication warns instead of blocking every run; the off-main check now matches its message. - A dispatch without force requires a successful push CI run on its commit. - A last chart that this workflow did not sign and attest does not count as published, so its commit can publish again. Addresses #2292 review comments: - MEDIUM .github/workflows/continuous.yml:169 (4262353943): forced rollback can't cross a VERSION bump - MEDIUM .github/workflows/continuous.yml:501 (4262353950): unsigned last chart counted as published - MEDIUM .github/workflows/continuous.yml:142 (4262353954): failed lookup blocks every publish, even with force - LOW .github/workflows/continuous.yml:121 (4262353989): dispatch publishes without checking CI - LOW .github/workflows/continuous.yml:104 (4262354000): move the resolve logic into a tested script Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Followers can select a chart as soon as it is pushed. Push, sign, attest, and verify the mecak8s chart before pushing the mecatl-studio chart, then verify that one the same way, so a failure never leaves the next chart pushed behind an unverified one. - Show helm's output when a chart push fails. - Log in to the chart registry with the token from env, as compute-version does. - Scan the mecak8s image for fixable critical vulnerabilities before signing it, as Studio is, and explain why ko tags it before the scan. - Correct the comment on the push order: a failure between the two charts leaves the new daemon with the previous Studio. Addresses #2292 review comments: - MEDIUM .github/workflows/continuous.yml:501 (4262353950): charts selectable before they're signed or attested - LOW .github/workflows/continuous.yml:490 (4262353966): the two charts can diverge; comment said otherwise - LOW .github/workflows/continuous.yml:498 (4262354005): failed chart push hides helm's error - LOW .github/workflows/continuous.yml:495 (4262354014): pass the token through env - LOW .github/workflows/continuous.yml:233 (4262354042): mecak8s tagged before verification and not scanned Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The README section repeated the workflow header. Keep what an operator acts on there (packages, verification, publishing by hand, rollback, partial failures) and leave the version scheme and publication order in the header. Drop the claim that a follower always gets images from one commit, which a failure between the two chart pushes can break. In the workflow header, point a rename at a release instead of a hand edit of VERSION, and say that a newer pending run replaces an older one, including a pending dispatch. Addresses #2292 review comments: - LOW .github/workflows/continuous.yml:48 (4262354020): a pending dispatch can be cancelled by a later run - LOW .github/workflows/README.md:12 (4262354048): README section repeats the workflow header - LOW .github/workflows/continuous.yml:12 (4262354057): "bump VERSION" advice describes a hand edit Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
41db157 to
6a72e27
Compare
Summary
Adds
.github/workflows/continuous.yml. It publishes signed builds ofmecak8s, Studio and both Helm charts from everymaincommit that passes CI, so an environment can followmaininstead of releases. The first follower is the stacklok/infradevcluster, through a Flux chart version range; that infra PR is linked below. Nothing in this repo writes to infra.Stacked on #2291 (the
mecatl-studiochart). The base branch isNashon-Steffen/studio-helm-chart; retarget tomainonce #2291 merges.How it works
workflow_runafter CI succeeds on a push tomainin this repository (fork pull requests from a branch namedmainare excluded), or a manual dispatch frommain.X.Y.(Z+1)-main.<run>.<attempt>.g<sha8>, from the commit'sVERSION. The patch bump sorts main builds above the last release, and the run number and attempt order them by publication time.mainthan the last publishedmecatl-studiochart, so followers never move back. A dispatch publishes the commit it ran from;forceoverrides both rules.ghcr.io/stacklok/mecatl/main/mecak8sis built with ko.ghcr.io/stacklok/mecatl/main/studiois built with buildx and scanned for fixable critical vulnerabilities.continuous.yml@refs/heads/mainbefore charts publish. Studio is tagged only after that verification.mecak8sandmecatl-studiogo tooci://ghcr.io/stacklok/mecatl/main/charts. Each chart'svalues.yamlis rewritten in the runner only (never committed) to pin its image by digest. The job checks the rendered manifests, then pushes, signs and attests the charts,mecak8sfirst and Studio last..github/workflows/README.mddocuments all of this.Issue relationship
Relates to #2291 and #2288 (continuous deployment of Studio from
main)Type of change
Test plan
Baseline checks
task lint): no Go changes. actionlint v1.7.7 (with shellcheck) reported nothing forcontinuous.yml.task test): no Go changes.task test:race): no Go changes.go run ./cmd/mecademo): no runtime changes.task docs:checkpassed with 0 broken links or anchors.task site:build)task api:check)task api:update+engine/CHANGELOG.mdExercised locally:
404 name unknown);forceis set;main;force, publishes an older commit.yqpin,helm lint,helm package --version 0.0.48-main.212.gb71e0ac9and render all pass, both charts render the digest-pinnedmain/images, and the version labels stay valid.main-latesttag backwards (that tag is gone);Not exercisable before merge:
workflow_runonly fires for workflows on the default branch. After merge, the first push tomainthat passes CI runs it.Special notes for reviewers
main/packages as private on first publish. stacklok/infra already pulls with a GHCR credential (ghcr-pull-secret). Decide whether to make them public.workflow_run: the attestation names themaincommit whosecontinuous.ymlran, which can be newer than the commit built. The image's revision label and the version name the commit that was built. Manual dispatches build their own commit unlessforceis set.mecak8stag is pushed before signing: ko pushesv<version>before the signature, as inrelease.yml'spublish-mecak8s. Followers use the charts, which pin digests only after verification.mainrolls dev, including docs-only merges: each build stamps a new version, so the image digests change.🤖 Generated with Claude Code