Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(deploy): add ghcr overlays and the render guard
Jose Ramirez527eec248658
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.ymlindex f4b5a3ed4..4e108b9a3 100644--- a/.github/workflows/ci-public.yml+++ b/.github/workflows/ci-public.yml@@ -360,6 +360,9 @@ jobs:- name: Test the ghcr-images kustomize componentrun: bash scripts/tests/test-ghcr-component.sh+ - name: Test the ghcr render guard+ run: bash scripts/tests/test-ghcr-render-guard.sh+- name: Test release image resolutionrun: bash scripts/tests/test-resolve-release-images.shdiff --git a/deploy/overlays/minikube-ghcr/kustomization.yaml b/deploy/overlays/minikube-ghcr/kustomization.yamlnew file mode 100644index 000000000..4212e407f--- /dev/null+++ b/deploy/overlays/minikube-ghcr/kustomization.yaml@@ -0,0 +1,19 @@+# The default minikube overlay, rendered against published ghcr images instead+# of locally built clerum/* ones. Selected by+# scripts/minikube/full-setup.sh when IMAGE_SOURCE=ghcr (the default).+#+# This file stays thin ON PURPOSE. Everything about the cluster lives in+# ../minikube; the only difference is the image coordinate, which the component+# owns. Adding a patch here would fork the two modes' cluster shape and make a+# ghcr-mode gate stop proving anything about a local-mode one.+#+# ACTIVE_MINIKUBE_KUSTOMIZE_DIR (where the generated k8s-api-ip.yaml lands)+# stays ../minikube; only ACTIVE_MINIKUBE_RENDER_DIR points here.+apiVersion: kustomize.config.k8s.io/v1beta1+kind: Kustomization++resources:+ - ../minikube++components:+ - ../../components/ghcr-imagesdiff --git a/deploy/overlays/minikube-no-uis-ghcr/kustomization.yaml b/deploy/overlays/minikube-no-uis-ghcr/kustomization.yamlnew file mode 100644index 000000000..d53a0eda7--- /dev/null+++ b/deploy/overlays/minikube-no-uis-ghcr/kustomization.yaml@@ -0,0 +1,12 @@+# The --skip-uis minikube overlay, rendered against published ghcr images.+# Selected by scripts/minikube/full-setup.sh when IMAGE_SOURCE=ghcr and+# SKIP_UIS=true. Thin for the same reason as ../minikube-ghcr: the only+# difference from ../minikube-no-uis is the image coordinate.+apiVersion: kustomize.config.k8s.io/v1beta1+kind: Kustomization++resources:+ - ../minikube-no-uis++components:+ - ../../components/ghcr-imagesdiff --git a/scripts/ci/check-ghcr-render.mjs b/scripts/ci/check-ghcr-render.mjsnew file mode 100644index 000000000..df787b295--- /dev/null+++ b/scripts/ci/check-ghcr-render.mjs@@ -0,0 +1,230 @@+#!/usr/bin/env node+// Render guard for ghcr mode. Asserts that a rendered ghcr overlay actually+// resolved: no clerum/ image REFERENCE survives, and every resolved+// ghcr.io/evenfire-ai ref carries the pinned tag.+//+// Asserting the resolved tag (not merely the absence of clerum/) is what makes+// this an INDEPENDENT observation of the release coordinate: it reads the+// artifact the overlay produced, rather than re-reading the field+// prepare-release.mjs wrote.+//+// node scripts/ci/check-ghcr-render.mjs rendered.yaml [more.yaml ...]+// [--component deploy/components/ghcr-images/kustomization.yaml]+// [--expect-tag v0.6.0]+//+// It matches FIELDS, not raw strings. Six clerum/ substrings survive a+// CORRECT render of the committed minikube-ghcr / minikube-no-uis-ghcr+// overlays, so a "zero clerum/ strings" guard is unsatisfiable:+// - three lines that are not `image:`/`value:` fields at all and are+// skipped naturally: one volume mountPath (/etc/clerum/...) and two+// ConfigMap `data:` key-value lines (a `KEY: ...clerum/...` mapping,+// not a YAML `value:` key) -- the built-in image transformer never+// touches ConfigMap data, only container `image:`/env `value:` fields+// - three prefix-allowlist / opt-in-local-build env `value:` fields,+// enumerated below in EXCEPTIONS. Every entry here is verified against+// the REAL rendered minikube-ghcr overlay -- an env var that only ever+// appears as a ConfigMap `data:` key (never a literal `value:` field)+// does not belong here, no matter how closely its name/value resembles+// a real exception: it would be a dead escape hatch in a guard whose+// job is to fail closed.+import fs from 'node:fs'+import path from 'node:path'+import process from 'node:process'++const DEFAULT_COMPONENT = 'deploy/components/ghcr-images/kustomization.yaml'+const GHCR_PREFIX = 'ghcr.io/evenfire-ai/'++// Every clerum/ value allowed to survive, keyed by env-var name and pinned to+// its EXACT value. Name-only entries would wave through a genuinely broken+// rewrite that happened to land on the same env var.+const EXCEPTIONS = new Map([+ // Tag-prefix allowlist with an EMPTY tag. workflow-custom-sdk-e2e is+ // published:false, therefore not pull_in_ghcr_mode, therefore it has no+ // component row and stays a local build -- so this prefix must stay clerum/.+ // It survives because no row exists, not because the transformer cannot+ // match it: add a row and kustomize rewrites this to+ // ghcr.io/evenfire-ai/workflow-custom-sdk-e2e:v0.6.0, appending a tag and+ // silently breaking the prefix match.+ ['WRC_ALLOWED_COORDINATOR_IMAGE_PREFIXES', 'clerum/workflow-custom-sdk-e2e:'],+ // mcp-host-desktop is deployed_to_minikube:false, so it gets no component+ // row. It is an opt-in local build in BOTH modes+ // (MINIKUBE_BUILD_DESKTOP_IMAGE=true), so this ref is not a ghcr-mode+ // regression -- it is the same ref local mode renders.+ ['CONTEXT_MAPPER_DESKTOP_IMAGE', 'clerum/mcp-host-desktop:test'],+ // A comma-separated PREFIX allowlist, not an image ref -- it already+ // permits the ghcr namespace, which is why ghcr-mode pods pass this+ // policy. This is host-context-controller's OWN copy+ // (deploy/base/control-plane/host-context-controller.yaml:115-116),+ // inlined as a literal env value. control-api carries the identical+ // string too (deploy/base/control-plane/configmaps.yaml), but ONLY as a+ // ConfigMap `data:` key consumed via `envFrom` -- it never renders as a+ // literal `value:` field, so it is deliberately NOT an entry here: a+ // name that can never match a real `value:` line is a dead escape hatch+ // in a guard whose job is to fail closed.+ [+ 'CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES',+ 'ghcr.io/evenfire-ai/,mongodb/,mcr.microsoft.com/,clerum/',+ ],+])++function argValue(name) {+ const index = process.argv.indexOf(name)+ return index >= 0 ? process.argv[index + 1] : ''+}++function die(message) {+ console.error(`::error::${message}`)+ process.exit(1)+}++// Positional args are the rendered files. Drop the flags AND the values that+// follow them by index, rather than by value: filtering by value would also+// drop a rendered file that happened to share a string with a flag value.+const FLAGS = new Set(['--component', '--expect-tag'])+const renderFiles = []+for (let i = 2; i < process.argv.length; i += 1) {+ const arg = process.argv[i]+ if (FLAGS.has(arg)) {+ i += 1 // skip its value+ continue+ }+ if (arg.startsWith('--')) continue+ renderFiles.push(arg)+}++if (renderFiles.length === 0) {+ die('no rendered files given; usage: check-ghcr-render.mjs <rendered.yaml> [more.yaml ...]')+}++let expectedTag = argValue('--expect-tag')+if (!expectedTag) {+ const componentPath = argValue('--component') || path.join(process.cwd(), DEFAULT_COMPONENT)+ let componentRaw+ try {+ componentRaw = fs.readFileSync(componentPath, 'utf8')+ } catch (error) {+ die(`could not read the ghcr component at ${componentPath}: ${error.message}`)+ }+ // Guarded: an unguarded match(...)[1] here would throw on a restructured+ // component and, with stderr swallowed, could read as a pass.+ const tags = [...componentRaw.matchAll(/^\s+newTag:\s*(\S+)\s*$/gm)].map(x => x[1])+ if (tags.length === 0) {+ die(+ `${componentPath} has no \`newTag:\` lines, so there is no pin to compare the render against`+ )+ }+ const distinct = [...new Set(tags)]+ // > 1, not !== 1: this check and the tags.length === 0 check above must be+ // DISJOINT conditions, or a component with zero newTag: lines trips both+ // and neither is independently provable by mutation testing (removing+ // either alone still dies, just via the other's message, which happens to+ // reuse the substring "newTag"). tags.length >= 1 is already guaranteed+ // here (the die() above is fatal), so distinct.length is never 0 at this+ // point -- "mixed" only means "more than one distinct value".+ if (distinct.length > 1) {+ die(+ `${componentPath} carries mixed newTag values (${distinct.join(', ')}); the pin must be one tag`+ )+ }+ expectedTag = distinct[0]+}++const problems = []+let ghcrRefsSeen = 0++// A container image field. Both `image: x` and `- image: x` forms appear in a+// rendered manifest (the latter inside a containers list rendered inline).+const IMAGE_FIELD = /^\s*-?\s*image:\s*'?"?([^\s'"]+)'?"?\s*$/+// An env-var value field.+const VALUE_FIELD = /^\s*value:\s*'?"?(.*?)'?"?\s*$/+// Env-var names are SCREAMING_SNAKE, which is what separates them from resource+// `name:` keys (control-ui, control-api) in the same rendered stream.+const ENV_NAME_FIELD = /^\s*-?\s*name:\s*([A-Z][A-Z0-9_]*)\s*$/+const GHCR_REF = /ghcr\.io\/evenfire-ai\/[a-z0-9][a-z0-9._-]*:([A-Za-z0-9._-]+)/g++function checkGhcrTags(where, text) {+ for (const match of text.matchAll(GHCR_REF)) {+ ghcrRefsSeen += 1+ if (match[1] !== expectedTag) {+ problems.push(+ `${where}: resolved tag is ${match[1]}, expected the pinned ${expectedTag} (${match[0]})`+ )+ }+ }+}++for (const file of renderFiles) {+ let raw+ try {+ raw = fs.readFileSync(file, 'utf8')+ } catch (error) {+ die(`could not read the rendered file ${file}: ${error.message}`)+ }+ const lines = raw.split('\n')+ let lastEnvName = ''++ for (let i = 0; i < lines.length; i += 1) {+ const line = lines[i]+ const where = `${file}:${i + 1}`++ const envName = line.match(ENV_NAME_FIELD)+ if (envName) lastEnvName = envName[1]++ const imageField = line.match(IMAGE_FIELD)+ if (imageField) {+ const ref = imageField[1]+ // No exceptions for container images. Every clerum/* container image in+ // these overlays has a component row, so a survivor means the rewrite+ // did not happen and the pod would ImagePullBackOff.+ if (ref.includes('clerum/') && !ref.startsWith(GHCR_PREFIX)) {+ problems.push(`${where}: container image ${ref} was not rewritten to ${GHCR_PREFIX}*`)+ }+ checkGhcrTags(where, ref)+ continue+ }++ const valueField = line.match(VALUE_FIELD)+ if (valueField) {+ const value = valueField[1]+ if (value.includes('clerum/')) {+ const allowed = EXCEPTIONS.get(lastEnvName)+ if (allowed === undefined) {+ problems.push(+ `${where}: env ${lastEnvName || '(unknown)'} value "${value}" still names clerum/ and is not a ` ++ `documented exception. If it is a prefix allowlist or an opt-in local build, add it to ` ++ `EXCEPTIONS in scripts/ci/check-ghcr-render.mjs with a comment saying why; otherwise its ` ++ `image lost its component row.`+ )+ } else if (allowed !== value) {+ problems.push(+ `${where}: env ${lastEnvName} is a documented exception but its value drifted: ` ++ `got "${value}", the exception pins "${allowed}"`+ )+ }+ }+ checkGhcrTags(where, value)+ }+ }+}++// A guard that observed nothing is broken, not green: an empty file, a wrong+// path, or a render that silently produced no workloads must be a red run.+if (ghcrRefsSeen === 0) {+ die(+ `scanned ${renderFiles.length} file(s) and found zero ${GHCR_PREFIX}* references. ` ++ `Either the wrong files were passed or the ghcr component did not apply; ` ++ `a render with no rewritten images is a failure, not a pass.`+ )+}++if (problems.length > 0) {+ console.error(+ `::error::ghcr render guard found ${problems.length} problem(s) across ${renderFiles.length} file(s)`+ )+ for (const p of problems) console.error(` ${p}`)+ process.exit(1)+}++console.log(+ `ghcr render guard: ${ghcrRefsSeen} image reference(s) across ${renderFiles.length} file(s), all at ${expectedTag}`+)diff --git a/scripts/tests/test-ghcr-render-guard.sh b/scripts/tests/test-ghcr-render-guard.shnew file mode 100755index 000000000..72c2e9edf--- /dev/null+++ b/scripts/tests/test-ghcr-render-guard.sh@@ -0,0 +1,295 @@+#!/usr/bin/env bash+set -u+FAIL=0++# scripts/ci/check-ghcr-render.mjs asserts that a ghcr-mode render actually+# resolved: no clerum/ image reference survives, and every resolved tag equals+# the pin in deploy/components/ghcr-images/kustomization.yaml.+#+# It matches FIELDS (`image:` and `value:`), not raw strings, because five+# clerum/ strings legitimately survive a correct render: two /etc/clerum/*+# mount paths (not image fields at all) and three documented prefix-allowlist+# or opt-in-local-build env values enumerated in the guard's EXCEPTIONS map.+# A naive "zero clerum/ strings" guard is unsatisfiable.++REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+GUARD="$REPO_ROOT/scripts/ci/check-ghcr-render.mjs"++pass() { echo "PASS: $1"; }+fail() { echo "FAIL: $1"; FAIL=1; }++# Every case renders against a throwaway component file so the fixtures do not+# have to be re-edited each time the real pin moves.+make_component() {+ local d=$1 tag=$2+ mkdir -p "$d"+ cat > "$d/kustomization.yaml" <<EOF+apiVersion: kustomize.config.k8s.io/v1alpha1+kind: Component+configurations:+ - imagetags.yaml+images:+ - name: clerum/control-api+ newName: ghcr.io/evenfire-ai/control-api+ newTag: $tag+EOF+}++# A minimal but REALISTIC clean render: a rewritten container image, a rewritten+# env-var image ref, and all three documented exceptions in their real form.+make_clean_render() {+ local f=$1 tag=$2+ cat > "$f" <<EOF+apiVersion: v1+kind: ConfigMap+metadata:+ name: control-api-config+data:+ CONTROL_API_ALLOWED_IMAGE_PREFIXES: ghcr.io/evenfire-ai/,mongodb/,mcr.microsoft.com/,clerum/+---+apiVersion: apps/v1+kind: Deployment+metadata:+ name: control-api+spec:+ template:+ spec:+ containers:+ - name: control-api+ image: ghcr.io/evenfire-ai/control-api:$tag+ volumeMounts:+ - mountPath: /etc/clerum/workflow-approval-request-reader+ name: targets+ env:+ - name: CONTEXT_MAPPER_GFSC_IMAGE+ value: ghcr.io/evenfire-ai/gfs-controller:$tag+ - name: CONTEXT_MAPPER_DESKTOP_IMAGE+ value: clerum/mcp-host-desktop:test+ - name: WRC_ALLOWED_COORDINATOR_IMAGE_PREFIXES+ value: 'clerum/workflow-custom-sdk-e2e:'+ - name: CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES+ value: ghcr.io/evenfire-ai/,mongodb/,mcr.microsoft.com/,clerum/+ - name: sidecar+ image: postgres:16-alpine+EOF+}++assert_a_clean_render_passes() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ make_clean_render "$d/render.yaml" v0.6.0+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -eq 0 ]; then+ pass "a clean render with all three documented exceptions passes"+ else+ fail "clean render rejected (rc=$rc): $out"+ fi+ rm -rf "$d"+}++assert_an_unrewritten_container_image_fails() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ make_clean_render "$d/render.yaml" v0.6.0+ printf ' - name: leftover\n image: clerum/control-api:test\n' >> "$d/render.yaml"+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "clerum/control-api:test" <<< "$out"; then+ pass "an unrewritten container image is rejected and named"+ else+ fail "expected a failure naming clerum/control-api:test; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# The independent-observation property (spec section 9): the guard reads the+# tag the overlay actually produced, not the field the writer wrote. A render+# left on the previous release must fail even though nothing says clerum/.+assert_a_stale_resolved_tag_fails() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ make_clean_render "$d/render.yaml" v0.5.0+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "v0.5.0" <<< "$out" && grep -q "v0.6.0" <<< "$out"; then+ pass "a resolved tag that disagrees with the pin is rejected, naming both tags"+ else+ fail "expected a failure naming v0.5.0 and v0.6.0; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# An undocumented clerum/ env value is the exact regression the EXCEPTIONS map+# exists to catch: it means an image ref stopped being rewritten. The grep+# also requires the guard's "is not a documented exception" wording (not just+# the env var name), because the sibling "value drifted" branch also names+# the env var in ITS message -- checking only the name would pass even if the+# "undocumented" branch were dead code and the "drifted" branch's undefined+# !== value fallthrough silently covered for it.+assert_an_undocumented_clerum_env_value_fails() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ make_clean_render "$d/render.yaml" v0.6.0+ printf ' - name: SOME_NEW_IMAGE\n value: clerum/some-new-image:test\n' >> "$d/render.yaml"+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "SOME_NEW_IMAGE" <<< "$out" && grep -q "not a documented exception" <<< "$out"; then+ pass "an undocumented clerum/ env value is rejected, naming the env var and the reason"+ else+ fail "expected a failure naming SOME_NEW_IMAGE and 'not a documented exception'; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# An exception is pinned to its EXACT value, not just its env-var name. If+# CONTEXT_MAPPER_DESKTOP_IMAGE ever changed to a different clerum image, the+# blanket-by-name form would wave it through. The grep also requires the+# guard's "value drifted" wording, distinguishing this from the sibling+# "undocumented" branch's message, which also names the env var.+assert_an_exception_with_a_drifted_value_fails() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ make_clean_render "$d/render.yaml" v0.6.0+ sed -i.bak 's#value: clerum/mcp-host-desktop:test#value: clerum/mcp-host-desktop:other#' "$d/render.yaml"+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "CONTEXT_MAPPER_DESKTOP_IMAGE" <<< "$out" && grep -q "value drifted" <<< "$out"; then+ pass "a documented exception whose value drifted is rejected"+ else+ fail "expected a failure naming CONTEXT_MAPPER_DESKTOP_IMAGE and 'value drifted'; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# The anti-vacuous-pass rule. A guard that scanned nothing is broken, not green.+assert_a_render_with_no_ghcr_refs_fails() {+ local d out rc+ d="$(mktemp -d)"+ make_component "$d/component" v0.6.0+ printf 'apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: empty\n' > "$d/render.yaml"+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -qi "zero" <<< "$out"; then+ pass "a render containing zero ghcr refs is rejected rather than passing vacuously"+ else+ fail "expected a failure about zero ghcr refs; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# A component with ZERO newTag: lines. This exercises tags.length === 0+# specifically -- distinct from a component whose newTag: lines DISAGREE+# (assert_a_component_with_mixed_newtag_values_fails_loudly below), which is+# a different failure mode with its own distinct.length > 1 check. The two+# checks compare tags.length === 0 vs distinct.length > 1 (not !== 1)+# precisely so they are DISJOINT: with zero tags, distinct.length is also 0,+# and 0 > 1 is false, so only the first check can ever fire for this fixture.+assert_an_unparseable_component_fails_loudly() {+ local d out rc+ d="$(mktemp -d)"+ mkdir -p "$d/component"+ printf 'apiVersion: kustomize.config.k8s.io/v1alpha1\nkind: Component\n' > "$d/component/kustomization.yaml"+ make_clean_render "$d/render.yaml" v0.6.0+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "has no \`newTag:\` lines" <<< "$out"; then+ pass "a component with no newTag: fails loudly instead of comparing against undefined"+ else+ fail "expected a failure naming 'has no \`newTag:\` lines'; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# The sibling case: newTag: lines are PRESENT but DISAGREE (a bad merge, a+# partial edit). tags.length is 2, not 0, so the check above cannot fire --+# only distinct.length > 1 can, making this test the independent proof that+# THAT check, not just the empty-tags one, is load-bearing.+assert_a_component_with_mixed_newtag_values_fails_loudly() {+ local d out rc+ d="$(mktemp -d)"+ mkdir -p "$d/component"+ cat > "$d/component/kustomization.yaml" <<EOF+apiVersion: kustomize.config.k8s.io/v1alpha1+kind: Component+configurations:+ - imagetags.yaml+images:+ - name: clerum/control-api+ newName: ghcr.io/evenfire-ai/control-api+ newTag: v0.6.0+ - name: clerum/control-ui+ newName: ghcr.io/evenfire-ai/control-ui+ newTag: v0.6.1+EOF+ make_clean_render "$d/render.yaml" v0.6.0+ out="$(node "$GUARD" "$d/render.yaml" --component "$d/component/kustomization.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ] && grep -q "mixed newTag values" <<< "$out" && grep -q "v0.6.1" <<< "$out"; then+ pass "a component whose newTag: lines disagree fails loudly, naming the mismatch"+ else+ fail "expected a failure naming 'mixed newTag values' including v0.6.1; got rc=$rc out='$out'"+ fi+ rm -rf "$d"+}++# The real thing. Renders both committed ghcr overlays with the repo's own+# kubectl and runs the guard over them, so a real overlay regression fails here+# and not only in the CI job Task 8 adds.+assert_both_committed_ghcr_overlays_render_clean() {+ if ! command -v kubectl >/dev/null 2>&1; then+ pass "SKIPPED (no kubectl on PATH): committed ghcr overlay render"+ return 0+ fi+ local d out rc+ d="$(mktemp -d)"+ cp -R "$REPO_ROOT/deploy" "$d/deploy"+ sed 's#__K8S_API_IP__#10.96.0.1#g' \+ "$d/deploy/overlays/minikube/patches/k8s-api-ip.yaml.template" \+ > "$d/deploy/overlays/minikube/patches/k8s-api-ip.yaml"+ if ! kubectl kustomize "$d/deploy/overlays/minikube-ghcr" > "$d/a.yaml" 2>"$d/err-a"; then+ fail "minikube-ghcr did not render: $(cat "$d/err-a")"; rm -rf "$d"; return 0+ fi+ if ! kubectl kustomize "$d/deploy/overlays/minikube-no-uis-ghcr" > "$d/b.yaml" 2>"$d/err-b"; then+ fail "minikube-no-uis-ghcr did not render: $(cat "$d/err-b")"; rm -rf "$d"; return 0+ fi+ out="$(node "$GUARD" "$d/a.yaml" "$d/b.yaml" 2>&1)"+ rc=$?+ if [ "$rc" -eq 0 ]; then+ pass "both committed ghcr overlays render with no surviving clerum/ image ref and the pinned tag throughout"+ else+ fail "committed ghcr overlay render rejected: $out"+ fi+ rm -rf "$d"+}++assert_every_defined_case_is_invoked() {+ local self defined invoked missing+ self="$REPO_ROOT/scripts/tests/test-ghcr-render-guard.sh"+ defined="$(grep -oE '^assert_[a-z_]+\(\) \{' "$self" | sed -E 's/\(\) \{$//' | sort -u)"+ invoked="$(grep -oE '^assert_[a-z_]+$' "$self" | sort -u)"+ missing="$(comm -23 <(printf '%s\n' "$defined") <(printf '%s\n' "$invoked"))"+ if [ -z "$missing" ]; then+ pass "every defined assert_ case is invoked in the call block"+ else+ fail "defined but never invoked: $(printf '%s ' $missing)"+ fi+}++assert_a_clean_render_passes+assert_an_unrewritten_container_image_fails+assert_a_stale_resolved_tag_fails+assert_an_undocumented_clerum_env_value_fails+assert_an_exception_with_a_drifted_value_fails+assert_a_render_with_no_ghcr_refs_fails+assert_an_unparseable_component_fails_loudly+assert_a_component_with_mixed_newtag_values_fails_loudly+assert_both_committed_ghcr_overlays_render_clean+assert_every_defined_case_is_invoked++exit $FAIL