Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(images): expand build-push's matrix per-image, not just per-arch

Jose Ramirez842d9ccb644c
diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml
index 2dddadb8f..77d156aeb 100644
--- a/.github/workflows/build-publish.yml
+++ b/.github/workflows/build-publish.yml
@@ -177,10 +177,46 @@ jobs:
strategy:
fail-fast: false
matrix:
- # Crossed against every `include` entry below (none of them set
- # `arch`), so each of the 28 images gets one amd64 leg and one arm64
- # leg — 56 combinations total, each on a runner native to its arch.
+ # `image` must be a real dimension here, not just a key inside each
+ # `include` entry. `arch` is the only *other* dimension, so the base
+ # cross-product is arch x image = 2 x 28 = 56 combinations; each
+ # `include` entry below (keyed by `image`) then merges its
+ # path/dockerfile/rooted/changed fields onto only the 2 combinations
+ # (one per arch) that share its `image` value. Drop the `image:`
+ # dimension and arch would be the *only* base dimension (2 total
+ # combinations), and all 28 `include` entries would stack onto those
+ # same 2, each overwriting the last — every leg ending up with
+ # whichever image's fields were declared last in the list.
arch: [amd64, arm64]
+ image:
+ - channel-reader
+ - workflow-approval-request-reader
+ - control-api
+ - control-ui
+ - external-rest-api
+ - host-context-controller
+ - mcp-host
+ - mcp-host-slim
+ - mcp-host-full
+ - mcp-host-desktop
+ - mcp-proxy
+ - gfs-controller
+ - nginx-egress-proxy
+ - profile-ui
+ - rpc-proxy
+ - workflow-recipes
+ - workflow-coordinator
+ - workflow-snippet-runner
+ - clerum-workflow-base
+ - stdio-bridge
+ - workspace-files-controller
+ - airtable-mcp-server
+ - playwright-server
+ - web-search-mcp
+ - mock-mcp-server
+ - mock-stdio-mcp-server
+ - webhook-gateway
+ - webhook-proxy
include:
- image: channel-reader
path: channel-reader
@@ -329,16 +365,23 @@ jobs:
context: ${{ steps.buildargs.outputs.context }}
file: ${{ steps.buildargs.outputs.file }}
platforms: linux/${{ matrix.arch }}
- # Attestations are disabled per-leg: imagetools builds the final index
- # from two platform digests, and an index-of-indexes is not valid, so
- # provenance cannot survive the merge as-is. Re-add later with a
- # dedicated attest step on the merged index if supply-chain metadata
- # is wanted back.
+ # Attestations are disabled per-leg. Provenance attestations don't
+ # push cleanly in push-by-digest mode (they need a repo:tag target,
+ # not a bare digest push), and `docker buildx imagetools create`
+ # flattens the source indexes it merges rather than carrying
+ # per-platform attestation manifests forward -- so provenance could
+ # not survive to the merged index anyway. Re-add later with a
+ # dedicated attest step on the merged index if supply-chain
+ # metadata is wanted back.
provenance: false
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.image }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.revision=${{ github.sha }}
- # Per-arch scope. Both legs previously wrote the same scope and thrashed.
+ # Per-arch scope: each arch now builds in its own job/leg (see the
+ # split above), so each needs its own gha cache scope. Before this
+ # change, one job built both platforms in a single buildx
+ # invocation and correctly shared one scope -- that's no longer
+ # true now that the legs are split.
cache-from: type=gha,scope=${{ matrix.image }}-${{ matrix.arch }}
cache-to: type=gha,scope=${{ matrix.image }}-${{ matrix.arch }},mode=max
@@ -490,7 +533,14 @@ jobs:
IMG="${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.image }}"
AMD64_DIGEST="$(cat "/tmp/digests/${{ matrix.image }}-amd64")"
ARM64_DIGEST="$(cat "/tmp/digests/${{ matrix.image }}-arm64")"
+ # The per-leg label on each platform manifest's config is not
+ # readable from the index itself (imagetools inspect --raw on the
+ # tag shows no revision without resolving a child manifest and
+ # pulling its config blob per platform). Task 4's resolver reads
+ # org.opencontainers.image.revision to pick the digest to promote,
+ # so it also needs to be an index-level annotation.
docker buildx imagetools create \
+ --annotation "index:org.opencontainers.image.revision=${GITHUB_SHA}" \
-t "$IMG:sha-${{ steps.shortsha.outputs.sha }}" \
-t "$IMG:latest" \
"$IMG@$AMD64_DIGEST" \
diff --git a/scripts/tests/test-images-manifest.sh b/scripts/tests/test-images-manifest.sh
index 9ef27f217..7cc9d28dd 100755
--- a/scripts/tests/test-images-manifest.sh
+++ b/scripts/tests/test-images-manifest.sh
@@ -233,6 +233,64 @@ assert_every_matrix_image_has_a_manifest_row() {
fi
}
+# build-push and merge each carry their own full copy of the 28-image list
+# (merge needs it to gate its own steps and to know which digest artifacts
+# to look for; build-push needs path/dockerfile/rooted too, which merge
+# doesn't). Nothing at the YAML level keeps the two in sync -- add an image
+# to build-push and forget merge, and the per-arch digests push while no
+# manifest list is ever created and no built-image marker is ever written
+# for it. notify-infra still dispatches (the other images' markers exist),
+# so the run is green with the new image silently unpublished: the same
+# fail-green shape as the build-push/merge needs: mismatch, one level down.
+#
+# Same guard-and-.catch() treatment as the other workflow-parsing cases
+# above, for the same reason: an unguarded regex index here would be the
+# identical vacuous-pass trap on a structural build-publish.yml change.
+assert_merge_matrix_images_match_build_push_matrix() {
+ local output rc
+ output="$(node -e '
+ import("node:fs").then(fs => {
+ const wfPath = "'"$REPO_ROOT"'/.github/workflows/build-publish.yml"
+ const wf = fs.readFileSync(wfPath, "utf8")
+
+ const buildPushMatch = wf.match(/\n build-push:\n[\s\S]*?include:\n([\s\S]*?)\n {4}steps:/)
+ if (!buildPushMatch) {
+ console.log(`PARSE_ERROR: could not find the build-push matrix section in ${wfPath}`)
+ process.exit(1)
+ }
+ const mergeMatch = wf.match(/\n merge:\n[\s\S]*?include:\n([\s\S]*?)\n {4}steps:/)
+ if (!mergeMatch) {
+ console.log(`PARSE_ERROR: could not find the merge matrix section in ${wfPath}`)
+ process.exit(1)
+ }
+
+ const namesOf = section => [...section.matchAll(/- image:\s*(\S+)/g)].map(x => x[1])
+ const buildPushNames = namesOf(buildPushMatch[1]).sort()
+ const mergeNames = namesOf(mergeMatch[1]).sort()
+
+ const missingFromMerge = buildPushNames.filter(n => !mergeNames.includes(n))
+ const extraInMerge = mergeNames.filter(n => !buildPushNames.includes(n))
+ const problems = []
+ if (buildPushNames.join(",") !== mergeNames.join(",")) {
+ if (missingFromMerge.length) problems.push(`missing from merge: ${missingFromMerge.join("|")}`)
+ if (extraInMerge.length) problems.push(`extra in merge (or a duplicate): ${extraInMerge.join("|")}`)
+ if (!missingFromMerge.length && !extraInMerge.length) problems.push("same names, different multiset (a duplicate is masking a missing entry)")
+ }
+ console.log(problems.join(";"))
+ }).catch(err => {
+ console.log(`PARSE_ERROR: ${err.message}`)
+ process.exit(1)
+ })' 2>&1)"
+ rc=$?
+ if [ "$rc" -ne 0 ]; then
+ fail "merge/build-push matrix comparison failed: $output"
+ elif [ -z "$output" ]; then
+ pass "merge's matrix image list matches build-push's exactly"
+ else
+ fail "merge and build-push matrix image lists disagree: $output"
+ fi
+}
+
# Portable across BSD grep (macOS, rejects -P) and GNU grep (conflicting
# matchers with -E -P together): sort both lists and diff with comm instead of
# depending on a PCRE lookahead inside a single grep invocation. The old
@@ -260,6 +318,7 @@ assert_pull_in_ghcr_mode_is_derived_not_stored
assert_unpublished_images_are_exactly_the_known_three
assert_matrix_fields_match_manifest
assert_every_matrix_image_has_a_manifest_row
+assert_merge_matrix_images_match_build_push_matrix
assert_every_defined_case_is_invoked
exit $FAIL