Skip to content

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

TypeScript

feat(minikube): default full-setup to pulling published images

Jose Ramirezfc118a685922
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.yml
index e3d042138..28c4ef847 100644
--- a/.github/workflows/ci-public.yml
+++ b/.github/workflows/ci-public.yml
@@ -366,6 +366,16 @@ jobs:
- name: Test the minikube image puller
run: bash scripts/tests/test-minikube-pull-images.sh
+ # ADMIN_PASSWORD is a required precondition of full-setup.sh Step 1 on the
+ # default (minimal) seed profile. Two cases in this harness execute the
+ # script against stubbed docker/minikube/kubectl, so without it they abort
+ # at Step 1. Developers get it from .env; CI has none, so supply a
+ # throwaway value. It never leaves the stubbed run.
+ - name: Test full-setup image source, tag override and banner
+ env:
+ ADMIN_PASSWORD: ci-stubbed-run-not-a-real-password
+ run: bash scripts/tests/test-minikube-full-setup.sh
+
- name: Test release image resolution
run: bash scripts/tests/test-resolve-release-images.sh
diff --git a/scripts/minikube/build-images.sh b/scripts/minikube/build-images.sh
index e1a55a246..be0607e01 100755
--- a/scripts/minikube/build-images.sh
+++ b/scripts/minikube/build-images.sh
@@ -20,12 +20,15 @@
# clerum/workflow-plugin-sdk-e2e:test <- tests/e2e/fixtures/workflow-plugin-sdk-e2e/Dockerfile
#
# Usage:
-# MINIKUBE_PROFILE=clerum-test ./scripts/minikube/build-images.sh [--skip-public] [--skip-uis] [--verify-only] [--only=<svc>]
+# MINIKUBE_PROFILE=clerum-test ./scripts/minikube/build-images.sh [--skip-public] [--skip-uis] [--verify-only] [--public-only] [--only=<svc>]
#
# Options:
# --skip-public Skip pulling/loading public images (postgres, redis, etc.)
# --skip-uis Skip Control UI, Profile UI, and Desktop App images.
# --verify-only Only verify image SHAs are present in minikube
+# --public-only Load only the public third-party images (postgres, redis,
+# nginx, ...) and build nothing. The IMAGE_SOURCE=ghcr path
+# needs them: no clerum build runs there to pull them in.
# --only=<svc> Build only the image(s) whose tag matches the substring <svc>
# (e.g. --only=control-api, --only=workflow-recipes). Skips
# public-image pulls and manifest regeneration.
@@ -69,6 +72,7 @@ PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
PROFILE="${MINIKUBE_PROFILE:-clerum-test}"
SKIP_PUBLIC=false
VERIFY_ONLY=false
+PUBLIC_ONLY=false
ONLY_SVC=""
FAILED_IMAGES=()
MINIKUBE_PRELOAD_BASE_IMAGES="${MINIKUBE_PRELOAD_BASE_IMAGES:-true}"
@@ -118,6 +122,7 @@ for arg in "$@"; do
--skip-public) SKIP_PUBLIC=true ;;
--skip-uis) SKIP_UIS=true ;;
--verify-only) VERIFY_ONLY=true ;;
+ --public-only) PUBLIC_ONLY=true ;;
--only=*) ONLY_SVC="${arg#--only=}" ;;
--include-desktop-image) MINIKUBE_BUILD_DESKTOP_IMAGE=true ;;
--include-playwright-mcp-image) MINIKUBE_BUILD_PLAYWRIGHT_MCP_IMAGE=true ;;
@@ -417,6 +422,18 @@ if [ "$VERIFY_ONLY" = true ]; then
exit 0
fi
+# Pull the public third-party images (postgres, redis, nginx, ...) without
+# building anything. The ghcr path needs them: no clerum image build runs
+# there, so nothing else pulls them into the daemon.
+#
+# It has to sit AFTER the `if [ -n "$ONLY_SVC" ]` normalizer near the top,
+# which forces SKIP_PUBLIC=true for any --only run; setting ONLY_SVC here
+# reaches build_image's filter (a runtime read) without tripping that.
+if [ "$PUBLIC_ONLY" = true ]; then
+ SKIP_PUBLIC=false
+ ONLY_SVC="__none__"
+fi
+
# ---- Build function ----
build_image() {
local name=$1 dir=$2 tag=$3 dockerfile=${4:-""}
diff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.sh
index 65d53a5ae..cab001fd7 100755
--- a/scripts/minikube/full-setup.sh
+++ b/scripts/minikube/full-setup.sh
@@ -21,6 +21,11 @@
# MINIKUBE_RECREATE_PROFILE=true Allow destructive profile recreation only
# CONFIRM_PROFILE=<profile> when it matches the exact target profile.
# BRANCH_PROFILE_DEPLOY_DIR=<dir> Optional branch-profile deploy cache root.
+# IMAGE_SOURCE=ghcr|local ghcr (default) pulls published images;
+# local builds all of them from source.
+# MINIKUBE_IMAGE_TAG=<tag> Render-time override of the committed
+# ghcr pin. Never committed. Use `latest`
+# before a release tag exists.
#
# Loads .env from project root if present (API keys, credentials).
# ======================================================================
@@ -121,6 +126,20 @@ case "${SKIP_UIS}" in
*) SKIP_UIS=false ;;
esac
+# ghcr (default): pull published ghcr.io/evenfire-ai images and render the
+# -ghcr overlays. local: build every image from source, today's behaviour.
+IMAGE_SOURCE="${IMAGE_SOURCE:-ghcr}"
+case "$IMAGE_SOURCE" in
+ ghcr|local) ;;
+ *) err "Unknown IMAGE_SOURCE: '${IMAGE_SOURCE}' (expected: ghcr | local)"; exit 1 ;;
+esac
+export IMAGE_SOURCE
+# A render-time override of the committed pin, NEVER committed. It exists for
+# two real needs the pin alone cannot serve: exercising the pull path before a
+# release tag exists (MINIKUBE_IMAGE_TAG=latest) and recovering from a bad
+# release forward (MINIKUBE_IMAGE_TAG=v0.6.1). See apply_image_tag_override.
+export MINIKUBE_IMAGE_TAG="${MINIKUBE_IMAGE_TAG:-}"
+
# Rebuild the DB from scratch by default (RESET_DB=true above) so a stale
# control-postgres volume from an older build cannot drift from the current
# schema/grant contract: the migration gate enforces an exact runtime-access
@@ -182,6 +201,11 @@ Environment:
BRANCH_PROFILE_DEPLOY_DIR
Optional deploy cache root; when set, kustomize uses
<dir>/overlays/minikube instead of PROJECT_DIR/deploy
+ IMAGE_SOURCE ghcr (default) pulls published ghcr.io/evenfire-ai
+ images; local builds every image from source
+ MINIKUBE_IMAGE_TAG Render-time override of the committed ghcr pin, applied
+ to a temp copy of deploy/ and never committed. Use
+ 'latest' before a release tag exists
Loads .env from project root if present. Supported variables:
OPENAI_API_KEY, CLAUDE_API_KEY, ZAI_API_KEY, BAILIAN_API_KEY
@@ -258,12 +282,109 @@ fi
PROFILE="${MINIKUBE_PROFILE:-clerum-test}"
KC="kubectl --context=${PROFILE}"
TOTAL_STEPS=12
+# MINIKUBE_IMAGE_TAG overrides the committed pin AT RENDER TIME ONLY.
+#
+# A stdout filter cannot do this: the overlay is rendered from a DIRECTORY at
+# four independent sites (`kubectl apply -k` at Step 6b, two
+# `kubectl kustomize | apply -f -` calls, and run-control-api-db-migration.sh,
+# which takes --overlay and extracts the control-api image from the render).
+# `kustomize edit set image` is not available either -- everything here uses
+# `kubectl kustomize`, and kubectl has no `edit` subcommand, so it would mean a
+# new prerequisite. Mutating the committed component in place would make this
+# operator lever a SECOND WRITER of the release coordinate, which is exactly
+# what the one-writer rule forbids.
+#
+# So: copy deploy/ to a temp dir, rewrite the component's newTag THERE, and
+# point the existing BRANCH_PROFILE_DEPLOY_DIR hook at the copy. The whole tree
+# must move because `resources: ../minikube` and
+# deploy/scripts/minikube-detect-k8s-api-ip.sh both resolve relative to that
+# root.
+apply_image_tag_override() {
+ [ "$IMAGE_SOURCE" = ghcr ] || return 0
+ [ -n "$MINIKUBE_IMAGE_TAG" ] || return 0
+
+ local src override_root
+ src="${BRANCH_PROFILE_DEPLOY_DIR:-${PROJECT_DIR}/deploy}"
+ override_root="$(mktemp -d)"
+ cp -R "$src" "${override_root}/deploy"
+
+ local component="${override_root}/deploy/components/ghcr-images/kustomization.yaml"
+ [ -f "$component" ] || { err "ghcr component not found in the deploy copy at ${component}"; exit 1; }
+
+ # In-place on the COPY only. -i.bak plus rm keeps this portable across BSD
+ # and GNU sed; `sed -i ''` is a BSD-only spelling that GNU sed rejects.
+ sed -i.bak "s|^\([[:space:]]*newTag:[[:space:]]*\).*$|\1${MINIKUBE_IMAGE_TAG}|" "$component"
+ rm -f "${component}.bak"
+
+ local rewritten
+ rewritten="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/p' "$component" | sort -u)"
+ [ "$rewritten" = "$MINIKUBE_IMAGE_TAG" ] \
+ || { err "tag override did not apply cleanly: copy now carries '${rewritten}', expected '${MINIKUBE_IMAGE_TAG}'"; exit 1; }
+
+ export BRANCH_PROFILE_DEPLOY_DIR="${override_root}/deploy"
+}
+apply_image_tag_override
+
ACTIVE_MINIKUBE_DEPLOY_DIR="${BRANCH_PROFILE_DEPLOY_DIR:-${PROJECT_DIR}/deploy}"
+# The kustomize dir is where the generated k8s-api-ip.yaml lands and where
+# patches/k8s-api-ip.yaml.template lives. It NEVER moves; only the render dir
+# switches between the plain and the -ghcr overlay.
ACTIVE_MINIKUBE_KUSTOMIZE_DIR="${ACTIVE_MINIKUBE_DEPLOY_DIR}/overlays/minikube"
-ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_KUSTOMIZE_DIR}"
-if [ "$SKIP_UIS" = true ]; then
- ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_DEPLOY_DIR}/overlays/minikube-no-uis"
+if [ "$IMAGE_SOURCE" = ghcr ]; then
+ if [ "$SKIP_UIS" = true ]; then
+ ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_DEPLOY_DIR}/overlays/minikube-no-uis-ghcr"
+ else
+ ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_DEPLOY_DIR}/overlays/minikube-ghcr"
+ fi
+else
+ if [ "$SKIP_UIS" = true ]; then
+ ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_DEPLOY_DIR}/overlays/minikube-no-uis"
+ else
+ ACTIVE_MINIKUBE_RENDER_DIR="${ACTIVE_MINIKUBE_KUSTOMIZE_DIR}"
+ fi
fi
+
+# The effective tag and where it came from, for the banner and for every error
+# message that has to tell an operator what to change.
+EFFECTIVE_IMAGE_TAG=""
+TAG_ORIGIN=""
+if [ "$IMAGE_SOURCE" = ghcr ]; then
+ if [ -n "$MINIKUBE_IMAGE_TAG" ]; then
+ EFFECTIVE_IMAGE_TAG="$MINIKUBE_IMAGE_TAG"
+ TAG_ORIGIN="MINIKUBE_IMAGE_TAG override (not committed)"
+ else
+ EFFECTIVE_IMAGE_TAG="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/p' \
+ "${ACTIVE_MINIKUBE_DEPLOY_DIR}/components/ghcr-images/kustomization.yaml" | sort -u | head -1)"
+ TAG_ORIGIN="committed pin in deploy/components/ghcr-images/kustomization.yaml"
+ fi
+fi
+
+print_image_source_banner() {
+ echo ""
+ echo -e "${BOLD}================================================================${NC}"
+ if [ "$IMAGE_SOURCE" = ghcr ]; then
+ echo -e "${BOLD} Images: PULLED from ghcr.io/evenfire-ai${NC}"
+ echo -e " tag: ${EFFECTIVE_IMAGE_TAG}"
+ echo -e " origin: ${TAG_ORIGIN}"
+ echo -e " build locally instead with: ${BOLD}make minikube-setup-local${NC}"
+ else
+ echo -e "${BOLD} Images: BUILT LOCALLY from source (IMAGE_SOURCE=local)${NC}"
+ echo -e " This is the slow path. The default pulls published images."
+ fi
+ echo -e " render: ${ACTIVE_MINIKUBE_RENDER_DIR#${ACTIVE_MINIKUBE_DEPLOY_DIR}/}"
+ echo -e "${BOLD}================================================================${NC}"
+}
+print_image_source_banner
+
+# Test seam: everything above resolves configuration only, with no cluster or
+# network call. `MINIKUBE_FULL_SETUP_CONFIG_ONLY=true` stops here so
+# scripts/tests/test-minikube-full-setup.sh can read the resolved values
+# without a cluster. It must stay immediately after the resolution block and
+# before the first minikube call.
+if [ "${MINIKUBE_FULL_SETUP_CONFIG_ONLY:-false}" = "true" ]; then
+ return 0 2>/dev/null || exit 0
+fi
+
MINIKUBE_START_SCRIPT="${MINIKUBE_START_SCRIPT:-${SCRIPT_DIR}/start.sh}"
minikube_status_snapshot() {
@@ -604,7 +725,10 @@ fi
step_header 5 $TOTAL_STEPS "Build Images"
if [ "$SKIP_BUILD" = true ]; then
- # Even with --skip-build, warn if local code is newer than images
+ # Even with --skip-build, warn if local code is newer than the images the
+ # cluster will run. The ADVICE has to branch on the mode: "rebuild" is wrong
+ # in ghcr mode, where nothing was built and rebuilding is precisely what the
+ # default path exists to avoid.
LAST_BUILD_MARKER="deploy/minikube/.image-manifest.json"
if [ -f "$LAST_BUILD_MARKER" ]; then
NEWEST_SRC=$(find \
@@ -617,15 +741,57 @@ if [ "$SKIP_BUILD" = true ]; then
control-ui/lib \
-type f -newer "$LAST_BUILD_MARKER" 2>/dev/null | head -1 || true)
if [ -n "$NEWEST_SRC" ]; then
- warn "Source files changed since last image build (e.g., $NEWEST_SRC)."
- warn "Images may be STALE. Run without --skip-build to rebuild."
+ if [ "$IMAGE_SOURCE" = ghcr ]; then
+ warn "Local source is newer than the pulled images (e.g., $NEWEST_SRC)."
+ warn "This cluster runs RELEASE images (${EFFECTIVE_IMAGE_TAG}); your local edits are NOT in them."
+ warn "To test local edits: 'make minikube-pre-gate-sync' shadow-builds only the changed"
+ warn "services over the release tag, or 'make minikube-setup-local' builds everything."
+ else
+ warn "Source files changed since last image build (e.g., $NEWEST_SRC)."
+ warn "Images may be STALE. Run without --skip-build to rebuild."
+ fi
else
- log "Skipping image build (--skip-build). No source changes detected since last build."
+ log "Skipping image acquisition (--skip-build). No source changes detected."
fi
else
- warn "No image manifest found — images may never have been built."
- warn "Run without --skip-build if pods show ImagePullBackOff or model-config-failed."
+ if [ "$IMAGE_SOURCE" = ghcr ]; then
+ warn "No image manifest found — images may never have been pulled."
+ warn "Run without --skip-build, or 'make minikube-pull-images', if pods show ImagePullBackOff."
+ else
+ warn "No image manifest found — images may never have been built."
+ warn "Run without --skip-build if pods show ImagePullBackOff or model-config-failed."
+ fi
fi
+elif [ "$IMAGE_SOURCE" = ghcr ]; then
+ # ORDER MATTERS. build-images.sh regenerates
+ # deploy/minikube/.image-manifest.json on EVERY invocation, including
+ # --only= runs (its header comment claims otherwise; the code at the bottom
+ # of the script is unconditional). So every build-images.sh call has to come
+ # BEFORE the pull, or it clobbers the puller's manifest -- the one file the
+ # --skip-build staleness check reads -- with a mostly-NOT_BUILT map.
+ #
+ # No clerum image build runs on this path, so nothing else pulls the public
+ # third-party images (postgres, redis, nginx, ...) into the daemon.
+ log "Loading public base images (postgres, redis, nginx, ...) into minikube..."
+ bash "${SCRIPT_DIR}/build-images.sh" --public-only
+ ok "Public base images loaded"
+
+ # The three published:false images (workflow-custom-sdk-e2e,
+ # workflow-plugin-sdk-e2e, doc-generator-mcp) have no ghcr counterpart.
+ # doc-generator-mcp is an ordinary MCP server the default path needs; the two
+ # fixtures are E2E-only and are built by `make minikube-setup-e2e` instead.
+ log "Building the unpublished image doc-generator-mcp locally..."
+ bash "${SCRIPT_DIR}/build-images.sh" --only=doc-generator-mcp
+ ok "doc-generator-mcp built"
+
+ log "Pulling published images (${EFFECTIVE_IMAGE_TAG}) into minikube..."
+ # `${MINIKUBE_MULTI_NODE:-false}`, not `$MINIKUBE_MULTI_NODE`: this script
+ # never assigns that variable (every other use site defaults it inline), so
+ # the bare form is an unbound-variable abort under `set -u` on the default
+ # single-node path.
+ MINIKUBE_PROFILE="$PROFILE" MINIKUBE_MULTI_NODE="${MINIKUBE_MULTI_NODE:-false}" \
+ bash "${SCRIPT_DIR}/pull-images.sh"
+ ok "All published images pulled"
else
log "Building and loading images into minikube..."
BUILD_IMAGE_ARGS=(--skip-public)
diff --git a/scripts/tests/test-minikube-full-setup.sh b/scripts/tests/test-minikube-full-setup.sh
index 2c5d55aef..e5792ee8a 100755
--- a/scripts/tests/test-minikube-full-setup.sh
+++ b/scripts/tests/test-minikube-full-setup.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -u
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+
FAIL=0
pass() { echo "PASS: $1"; }
@@ -350,6 +352,223 @@ assert_pipefail_head_guard_prevents_abort() {
fi
}
+# full-setup.sh is a 1284-line orchestrator that needs a real cluster to run,
+# so these cases read its resolved configuration rather than executing it: they
+# source the top of the script with a guard variable set, which stops it before
+# the first cluster call. That is the same seam the existing profile cases use,
+# applied to variables instead of to minikube invocations.
+#
+# The stub dir is a safety net, not decoration. Config resolution calls none of
+# docker/minikube/kubectl, so if the config-only seam is ever deleted or moved,
+# `source full-setup.sh` would otherwise drive a REAL cluster from a unit test.
+# The stubs fail loudly instead, which aborts the sourced script at Step 1 and
+# leaves the assertion reading an empty value -- a red test, never a green one.
+FULL_SETUP_STUB_DIR="$(mktemp -d)"
+for _stub in docker minikube kubectl; do
+ cat > "$FULL_SETUP_STUB_DIR/$_stub" <<STUB
+#!/usr/bin/env bash
+echo "STUB: '$_stub' must not be called while resolving full-setup.sh config" >&2
+exit 1
+STUB
+ chmod +x "$FULL_SETUP_STUB_DIR/$_stub"
+done
+unset _stub
+trap 'rm -rf "$FULL_SETUP_STUB_DIR"' EXIT
+
+full_setup_resolves() {
+ # full_setup_resolves <var> [env assignments...]
+ local var="$1"; shift
+ env "$@" PATH="$FULL_SETUP_STUB_DIR:$PATH" MINIKUBE_FULL_SETUP_CONFIG_ONLY=true \
+ bash -c 'source "$0" >/dev/null 2>&1; printf "%s" "${'"$var"'}"' \
+ "$REPO_ROOT/scripts/minikube/full-setup.sh"
+}
+
+assert_ghcr_is_the_default_image_source() {
+ local got
+ got="$(full_setup_resolves IMAGE_SOURCE)"
+ if [ "$got" = "ghcr" ]; then
+ pass "IMAGE_SOURCE defaults to ghcr"
+ else
+ fail "IMAGE_SOURCE defaulted to '${got}', expected 'ghcr'"
+ fi
+}
+
+assert_image_source_local_is_honoured() {
+ local got
+ got="$(full_setup_resolves IMAGE_SOURCE IMAGE_SOURCE=local)"
+ if [ "$got" = "local" ]; then
+ pass "IMAGE_SOURCE=local is honoured"
+ else
+ fail "IMAGE_SOURCE=local resolved to '${got}'"
+ fi
+}
+
+assert_an_unknown_image_source_is_a_hard_error() {
+ local out rc
+ out="$(env PATH="$FULL_SETUP_STUB_DIR:$PATH" IMAGE_SOURCE=gchr \
+ MINIKUBE_FULL_SETUP_CONFIG_ONLY=true \
+ bash "$REPO_ROOT/scripts/minikube/full-setup.sh" 2>&1)"; rc=$?
+ if [ "$rc" -ne 0 ] && grep -qi "IMAGE_SOURCE" <<< "$out"; then
+ pass "an unknown IMAGE_SOURCE fails loudly instead of falling back"
+ else
+ fail "expected a hard error naming IMAGE_SOURCE; got rc=$rc out='$out'"
+ fi
+}
+
+# Only the RENDER dir moves. The kustomize dir is where the generated
+# k8s-api-ip.yaml lands and where the template lives; moving it would break
+# minikube-detect-k8s-api-ip.sh and the patchesStrategicMerge reference.
+assert_ghcr_mode_moves_only_the_render_dir() {
+ local render kustomize
+ render="$(full_setup_resolves ACTIVE_MINIKUBE_RENDER_DIR)"
+ kustomize="$(full_setup_resolves ACTIVE_MINIKUBE_KUSTOMIZE_DIR)"
+ if [[ "$render" == */overlays/minikube-ghcr ]] && [[ "$kustomize" == */overlays/minikube ]]; then
+ pass "ghcr mode renders minikube-ghcr while the kustomize dir stays overlays/minikube"
+ else
+ fail "render='${render}' kustomize='${kustomize}'"
+ fi
+}
+
+assert_ghcr_mode_with_skip_uis_renders_the_no_uis_ghcr_overlay() {
+ local render
+ render="$(full_setup_resolves ACTIVE_MINIKUBE_RENDER_DIR MINIKUBE_SKIP_UIS=true)"
+ if [[ "$render" == */overlays/minikube-no-uis-ghcr ]]; then
+ pass "ghcr + --skip-uis renders minikube-no-uis-ghcr"
+ else
+ fail "render dir was '${render}'"
+ fi
+}
+
+assert_local_mode_renders_the_unchanged_overlays() {
+ local a b
+ a="$(full_setup_resolves ACTIVE_MINIKUBE_RENDER_DIR IMAGE_SOURCE=local)"
+ b="$(full_setup_resolves ACTIVE_MINIKUBE_RENDER_DIR IMAGE_SOURCE=local MINIKUBE_SKIP_UIS=true)"
+ if [[ "$a" == */overlays/minikube ]] && [[ "$b" == */overlays/minikube-no-uis ]]; then
+ pass "local mode renders today's overlays unchanged"
+ else
+ fail "local render dirs were '${a}' and '${b}'"
+ fi
+}
+
+# Never `rm -rf "$(dirname "$1")"` unguarded: `dirname ""` is `.`, so an
+# assertion that failed to resolve a deploy dir would delete the caller's
+# working directory. Only remove a path that is an absolute */deploy outside
+# the repo.
+remove_override_copy() {
+ local deploy_dir="${1:-}"
+ case "$deploy_dir" in
+ /*/deploy) ;;
+ *) return 0 ;;
+ esac
+ [ "$deploy_dir" = "$REPO_ROOT/deploy" ] && return 0
+ rm -rf "$(dirname "$deploy_dir")"
+}
+
+# The override must never touch the committed tree. A single in-place `sed` on
+# deploy/components/ghcr-images/kustomization.yaml would make the operator lever
+# a second writer of the release coordinate.
+assert_the_tag_override_copies_the_tree_and_leaves_the_commit_alone() {
+ local before after deploy_dir
+ before="$(git -C "$REPO_ROOT" status --porcelain deploy/components/ghcr-images | wc -l | tr -d ' ')"
+ deploy_dir="$(full_setup_resolves ACTIVE_MINIKUBE_DEPLOY_DIR MINIKUBE_IMAGE_TAG=latest)"
+ after="$(git -C "$REPO_ROOT" status --porcelain deploy/components/ghcr-images | wc -l | tr -d ' ')"
+ if [ "$before" = "$after" ] && [ -n "$deploy_dir" ] && [[ "$deploy_dir" != "$REPO_ROOT/deploy" ]]; then
+ pass "MINIKUBE_IMAGE_TAG renders from a temp copy and leaves the committed component untouched"
+ else
+ fail "deploy dir was '${deploy_dir}' (repo deploy is $REPO_ROOT/deploy); git status lines before=$before after=$after"
+ fi
+ remove_override_copy "$deploy_dir"
+}
+
+# The whole tree must move: resources: ../minikube and
+# deploy/scripts/minikube-detect-k8s-api-ip.sh both resolve relative to the
+# deploy root, so copying only the component would break both.
+assert_the_tag_override_copy_is_a_whole_deploy_tree_with_the_new_tag() {
+ local deploy_dir tag problems=""
+ deploy_dir="$(full_setup_resolves ACTIVE_MINIKUBE_DEPLOY_DIR MINIKUBE_IMAGE_TAG=v9.9.9)"
+ [ -d "$deploy_dir/overlays/minikube" ] || problems+="no overlays/minikube in the copy; "
+ [ -d "$deploy_dir/overlays/minikube-ghcr" ] || problems+="no overlays/minikube-ghcr in the copy; "
+ [ -f "$deploy_dir/scripts/minikube-detect-k8s-api-ip.sh" ] || problems+="no deploy/scripts in the copy; "
+ # No 2>/dev/null here: if the component is missing from the copy, sed's error
+ # belongs in the transcript, not swallowed into an empty-string "mismatch".
+ tag="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\).*$/\1/p' \
+ "$deploy_dir/components/ghcr-images/kustomization.yaml" | sort -u | tr '\n' ' ')"
+ [ "$tag" = "v9.9.9 " ] || problems+="copy's newTag is '${tag}', expected 'v9.9.9 '; "
+ if [ -z "$problems" ]; then
+ pass "the override copy is a whole deploy tree with every newTag rewritten"
+ else
+ fail "$problems"
+ fi
+ remove_override_copy "$deploy_dir"
+}
+
+# "Run without --skip-build to rebuild" is wrong advice in ghcr mode: nothing
+# was built, and rebuilding is exactly what the default path exists to avoid.
+#
+# The block is extracted with awk, not `sed -n '/start/,/^else$/p'`: the sed
+# range would run past the SKIP_BUILD branch and swallow the
+# `elif [ "$IMAGE_SOURCE" = ghcr ]` acquisition arm below it, so a staleness
+# warning with no mode-awareness left in it would still match on the elif and
+# report PASS. awk stops BEFORE the terminating elif/else.
+assert_the_skip_build_staleness_advice_is_mode_aware() {
+ local sh block
+ sh="$REPO_ROOT/scripts/minikube/full-setup.sh"
+ block="$(awk '/Even with --skip-build, warn if local code is newer/{f=1}
+ f && /^(elif|else)/{exit}
+ f' "$sh")"
+ if [ -z "$block" ]; then
+ fail "could not locate the --skip-build staleness block in $sh"
+ return
+ fi
+ if grep -q 'IMAGE_SOURCE' <<< "$block" \
+ && grep -q 'minikube-pull-images\|IMAGE_SOURCE=local' <<< "$block"; then
+ pass "the --skip-build staleness warning branches on IMAGE_SOURCE"
+ else
+ fail "the --skip-build staleness block still gives build-only advice: $block"
+ fi
+}
+
+# A contributor must be able to tell from the transcript which images the
+# cluster is about to run and where the tag came from.
+assert_the_banner_names_the_source_the_tag_and_its_origin() {
+ local sh
+ sh="$REPO_ROOT/scripts/minikube/full-setup.sh"
+ local missing=""
+ grep -q 'print_image_source_banner' "$sh" || missing+="no print_image_source_banner function; "
+ grep -q 'TAG_ORIGIN' "$sh" || missing+="no TAG_ORIGIN variable; "
+ if [ -z "$missing" ]; then
+ pass "the setup prints an image-source banner naming source, tag and origin"
+ else
+ fail "$missing"
+ fi
+}
+
+assert_the_tag_origin_distinguishes_pin_from_override() {
+ local pinned overridden
+ pinned="$(full_setup_resolves TAG_ORIGIN)"
+ overridden="$(full_setup_resolves TAG_ORIGIN MINIKUBE_IMAGE_TAG=latest)"
+ if grep -qi "pin" <<< "$pinned" && grep -q "MINIKUBE_IMAGE_TAG" <<< "$overridden"; then
+ pass "TAG_ORIGIN distinguishes the committed pin from the override"
+ else
+ fail "TAG_ORIGIN was '${pinned}' (pinned) and '${overridden}' (overridden)"
+ fi
+}
+
+# The guard that keeps this file honest: a case defined but never added to the
+# call block below reports nothing at all, which reads as a green run.
+assert_every_defined_case_is_invoked() {
+ local self defined invoked missing
+ self="$REPO_ROOT/scripts/tests/test-minikube-full-setup.sh"
+ defined="$(grep -oE '^assert_[a-z_0-9]+\(\) \{' "$self" | sed -E 's/\(\) \{$//' | sort -u)"
+ invoked="$(grep -oE '^assert_[a-z_0-9]+$' "$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_broken_profile_is_recreated
assert_healthy_profile_skips_recreate
assert_branch_profile_deploy_dir_is_used
@@ -362,5 +581,17 @@ assert_reuse_db_normalizer_precedes_flag_loop
assert_reset_db_flag_backcompat
assert_skip_build_staleness_find_is_sigpipe_guarded
assert_pipefail_head_guard_prevents_abort
+assert_ghcr_is_the_default_image_source
+assert_image_source_local_is_honoured
+assert_an_unknown_image_source_is_a_hard_error
+assert_ghcr_mode_moves_only_the_render_dir
+assert_ghcr_mode_with_skip_uis_renders_the_no_uis_ghcr_overlay
+assert_local_mode_renders_the_unchanged_overlays
+assert_the_tag_override_copies_the_tree_and_leaves_the_commit_alone
+assert_the_tag_override_copy_is_a_whole_deploy_tree_with_the_new_tag
+assert_the_skip_build_staleness_advice_is_mode_aware
+assert_the_banner_names_the_source_the_tag_and_its_origin
+assert_the_tag_origin_distinguishes_pin_from_override
+assert_every_defined_case_is_invoked
exit $FAIL