Skip to content

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

TypeScript

fix(minikube): resolve the image mode and tag from what the cluster acquired

Jose Ramirez3620d938378a
diff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.sh
index a21c205b2..b86643bec 100755
--- a/scripts/minikube/full-setup.sh
+++ b/scripts/minikube/full-setup.sh
@@ -132,6 +132,10 @@ esac
# ghcr (default): pull published ghcr.io/evenfire-ai images and render the
# -ghcr overlays. local: build every image from source, today's behaviour.
+#
+# This is what an ACQUIRING run would do. A --skip-build run acquires nothing,
+# so it re-resolves the mode from what the cluster actually holds -- see the
+# image_mode_source block after the flag loop.
IMAGE_SOURCE="${IMAGE_SOURCE:-ghcr}"
case "$IMAGE_SOURCE" in
ghcr|local) ;;
@@ -206,9 +210,12 @@ Environment:
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
+ images; local builds every image from source. Ignored
+ with --skip-build, which acquires nothing and so
+ follows what the cluster already holds
+ MINIKUBE_IMAGE_TAG Render-time override applied to a temp copy of deploy/
+ and never committed. Without it the tag is whatever the
+ last acquisition recorded, else the committed pin. Use
'latest' before a release tag exists
Loads .env from project root if present. Supported variables:
@@ -249,6 +256,39 @@ case "${SEED_PROFILE}" in
*) err "Unknown --seed-profile: '${SEED_PROFILE}' (expected: minimal | e2e)"; exit 1 ;;
esac
+# ── The mode follows the cluster on a run that acquires nothing ────────
+#
+# THE OVERLAY MUST FOLLOW THE IMAGES ON THE NODE, NOT THIS SHELL. --skip-build
+# re-deploys WITHOUT pulling or building anything, so the only truthful source
+# for "which images does this cluster run" is what the last acquisition
+# recorded. Taking IMAGE_SOURCE instead rendered the -ghcr overlays over a
+# locally built cluster -- every Deployment then names a ghcr ref nothing ever
+# pulled, i.e. cluster-wide ImagePullBackOff -- and the mirror image (clerum/*
+# refs over a pulled cluster) is the same bug with the operands swapped. It is
+# not a rare path: `make minikube-setup` ALWAYS passes IMAGE_SOURCE (the
+# Makefile defaults it to ghcr), so the environment can never be read as "the
+# operator asked for this".
+#
+# On an ACQUIRING run the environment still decides, because that run is about
+# to rewrite the record -- otherwise `make minikube-setup-local` over a pulled
+# cluster could never switch a cluster back to local builds.
+#
+# image_mode_source falls back to the environment when nothing is recorded, so
+# the FIRST run on a fresh cluster is unchanged; this is the same resolver
+# `make minikube-deploy-all` and `build-images.sh --verify-only` already use.
+# shellcheck source=scripts/minikube/image-mode.sh
+source "${SCRIPT_DIR}/image-mode.sh"
+if [ "$SKIP_BUILD" = true ]; then
+ RECORDED_IMAGE_SOURCE="$(image_mode_source "$PROJECT_DIR")" || exit 1
+ if [ "$RECORDED_IMAGE_SOURCE" != "$IMAGE_SOURCE" ]; then
+ warn "This cluster's images were acquired as IMAGE_SOURCE=${RECORDED_IMAGE_SOURCE} (deploy/minikube/.image-manifest.json)."
+ warn "--skip-build acquires nothing, so the overlay follows the cluster, not IMAGE_SOURCE=${IMAGE_SOURCE}."
+ warn "To change the mode, re-run WITHOUT --skip-build so the images are actually re-acquired."
+ IMAGE_SOURCE="$RECORDED_IMAGE_SOURCE"
+ export IMAGE_SOURCE
+ fi
+fi
+
# ── Load .env ──────────────────────────────────────────────────────────
# Worktrees resolve through git-common-dir to the primary checkout. Dotenv is
# parsed as data (never sourced as shell code), and admin aliases use the
@@ -332,16 +372,29 @@ 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.
+#
+# Reading the committed pin here ignored the tag the cluster actually holds: on
+# the documented `MINIKUBE_IMAGE_TAG=latest make minikube-setup` bootstrap, any
+# LATER run (which has no such variable) reported and acted on v0.6.0 against a
+# cluster running :latest. image_mode_ghcr_tag applies override -> recorded ->
+# pin, the same precedence pull-images.sh and build-images.sh --verify-only
+# use; the `= ghcr` branch above is this file's mode gate, which is why the
+# ungated ghcr resolver is the right one to call.
+#
+# The pin is read from PROJECT_DIR, not ACTIVE_MINIKUBE_DEPLOY_DIR: the two
+# differ only when MINIKUBE_IMAGE_TAG rewrote a copy, and that override already
+# wins ahead of any pin.
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"
+ EFFECTIVE_IMAGE_TAG="$(image_mode_ghcr_tag "$PROJECT_DIR")" || exit 1
+ TAG_ORIGIN="$(image_mode_tag_origin "$PROJECT_DIR")" || exit 1
+ # Never continue on an empty tag: every ref built from it would be tagless,
+ # and the banner would confidently print nothing at all.
+ if [ -z "$EFFECTIVE_IMAGE_TAG" ] || [ -z "$TAG_ORIGIN" ]; then
+ err "could not resolve the ghcr image tag (tag='${EFFECTIVE_IMAGE_TAG}' origin='${TAG_ORIGIN}')"
+ err "Set MINIKUBE_IMAGE_TAG=<tag>, or fix deploy/components/ghcr-images/kustomization.yaml."
+ exit 1
fi
fi
@@ -774,12 +827,24 @@ elif [ "$IMAGE_SOURCE" = ghcr ]; then
# them: `make minikube-setup-e2e`.
log "Pulling published images (${EFFECTIVE_IMAGE_TAG}) into minikube..."
+ # --skip-uis is forwarded for the same reason the local build path passes it:
+ # the -no-uis-ghcr overlay DELETES the control-ui and profile-ui Deployments,
+ # so pulling them spends ~470 MiB of transfer and disk on images no pod will
+ # ever reference.
+ PULL_IMAGE_ARGS=()
+ if [ "$SKIP_UIS" = true ]; then
+ PULL_IMAGE_ARGS+=(--skip-uis)
+ fi
+ # `${PULL_IMAGE_ARGS[@]+"${PULL_IMAGE_ARGS[@]}"}`: expanding an EMPTY array as
+ # `"${arr[@]}"` is an unbound-variable abort under `set -u` in bash 3.2, which
+ # is what /bin/bash on macOS still is.
+ #
# `${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"
+ bash "${SCRIPT_DIR}/pull-images.sh" ${PULL_IMAGE_ARGS[@]+"${PULL_IMAGE_ARGS[@]}"}
ok "All published images pulled"
else
log "Building and loading images into minikube..."
diff --git a/scripts/minikube/image-mode.sh b/scripts/minikube/image-mode.sh
index 860c492d7..7a0abe030 100755
--- a/scripts/minikube/image-mode.sh
+++ b/scripts/minikube/image-mode.sh
@@ -135,17 +135,22 @@ image_mode_pinned_tag() {
printf '%s' "$tags"
}
-# The ghcr tag this cluster runs: the explicit override, else what the last
-# acquisition recorded, else the committed pin. Empty in local mode, where there
-# is no ghcr coordinate at all.
-image_mode_tag() {
- local project_dir="${1:-$IMAGE_MODE_PROJECT_DIR}" mode recorded tag
- if ! mode="$(image_mode_source "$project_dir")"; then
- return 1
- fi
- if [ "$mode" != ghcr ]; then
- return 0
- fi
+# THE ghcr tag precedence, with no mode gate: the explicit override, else what
+# the last acquisition recorded, else the committed pin.
+#
+# Callers that have already decided they are dealing with ghcr images use this
+# one. scripts/minikube/pull-images.sh is the reason it exists separately from
+# image_mode_tag: pulling IS a ghcr acquisition (it rewrites the manifest with
+# imageSource "ghcr" when it finishes), so a cluster whose CURRENT record says
+# "local" must still resolve a tag to pull rather than the empty string the
+# mode gate would return. scripts/minikube/full-setup.sh is the same shape --
+# its own `[ "$IMAGE_SOURCE" = ghcr ]` branch is the gate.
+#
+# There is exactly one copy of this precedence; image_mode_tag delegates to it
+# rather than repeating it, because two copies is how the consumers came to
+# disagree in the first place.
+image_mode_ghcr_tag() {
+ local project_dir="${1:-$IMAGE_MODE_PROJECT_DIR}" recorded tag
if [ -n "${MINIKUBE_IMAGE_TAG:-}" ]; then
tag="$MINIKUBE_IMAGE_TAG"
else
@@ -169,6 +174,41 @@ image_mode_tag() {
printf '%s' "$tag"
}
+# Where image_mode_ghcr_tag's answer came from, as operator-facing text.
+#
+# It lives next to the resolution it describes so the two cannot drift: an
+# error that tells someone to change the committed pin when the value actually
+# came from the recorded manifest sends them to edit the wrong file, and the
+# edit does nothing.
+image_mode_tag_origin() {
+ local project_dir="${1:-$IMAGE_MODE_PROJECT_DIR}" recorded
+ if [ -n "${MINIKUBE_IMAGE_TAG:-}" ]; then
+ printf '%s' 'MINIKUBE_IMAGE_TAG override (not committed)'
+ return 0
+ fi
+ if ! recorded="$(image_mode_manifest_field "$project_dir" 2)"; then
+ return 1
+ fi
+ if [ -n "$recorded" ]; then
+ printf '%s' 'tag recorded in deploy/minikube/.image-manifest.json (what this cluster last acquired)'
+ return 0
+ fi
+ printf '%s' 'committed pin in deploy/components/ghcr-images/kustomization.yaml'
+}
+
+# The ghcr tag this cluster runs. Empty in local mode, where there is no ghcr
+# coordinate at all.
+image_mode_tag() {
+ local project_dir="${1:-$IMAGE_MODE_PROJECT_DIR}" mode
+ if ! mode="$(image_mode_source "$project_dir")"; then
+ return 1
+ fi
+ if [ "$mode" != ghcr ]; then
+ return 0
+ fi
+ image_mode_ghcr_tag "$project_dir"
+}
+
# When the last image acquisition happened. A `make minikube-setup` between two
# pre-gates replaces every image and discards any shadow build, so a marker
# stamped before it describes a cluster that no longer exists.
diff --git a/scripts/minikube/pull-images.sh b/scripts/minikube/pull-images.sh
index 010394888..f4856e5b5 100755
--- a/scripts/minikube/pull-images.sh
+++ b/scripts/minikube/pull-images.sh
@@ -14,9 +14,11 @@
# MINIKUBE_PROFILE=clerum-test ./scripts/minikube/pull-images.sh [--only=<svc>]
#
# Env:
-# MINIKUBE_IMAGE_TAG Override the committed pin (render-time only,
-# never committed). Use `latest` to exercise the
-# pull path before a release tag exists.
+# MINIKUBE_IMAGE_TAG Override the recorded/committed tag (render-time
+# only, never committed). Use `latest` to exercise
+# the pull path before a release tag exists.
+# MINIKUBE_SKIP_UIS true -> do not pull control-ui/profile-ui, which
+# the -no-uis overlays delete anyway (see below).
# MINIKUBE_PROFILE Target profile (default: clerum-test)
# MINIKUBE_MULTI_NODE true -> pull on the host + `minikube image load`
# MINIKUBE_PULL_PARALLELISM Concurrent pulls (default: 6)
@@ -56,6 +58,11 @@
# involved. The one manifest still naming a local MCP-server ref
# (instances-e2e/airtable-server.yaml, SEED_PROFILE=e2e only) is served by
# an opt-in local build instead -- see MINIKUBE_BUILD_AIRTABLE_MCP_IMAGE.
+#
+# 3. --skip-uis / MINIKUBE_SKIP_UIS drops control-ui and profile-ui from the
+# pull list, mirroring build-images.sh's identical filter. The
+# -no-uis-ghcr overlay DELETES both Deployments, so pulling them costs
+# ~470 MiB of transfer and disk for images no pod will ever reference.
# ======================================================================
set -euo pipefail
@@ -69,12 +76,20 @@ PULL_PARALLELISM="${MINIKUBE_PULL_PARALLELISM:-6}"
MINIKUBE_IMAGE_PULL_RETRIES="${MINIKUBE_IMAGE_PULL_RETRIES:-3}"
MINIKUBE_IMAGE_PULL_DELAY_SECS="${MINIKUBE_IMAGE_PULL_DELAY_SECS:-5}"
GHCR_NAMESPACE="ghcr.io/evenfire-ai"
-COMPONENT="${PROJECT_DIR}/deploy/components/ghcr-images/kustomization.yaml"
ONLY_SVC=""
+# Same normalizer and same flag name build-images.sh uses, so the two halves of
+# `--skip-uis` cannot disagree about what the word means.
+SKIP_UIS="${MINIKUBE_SKIP_UIS:-false}"
+case "${SKIP_UIS}" in
+ true | 1 | yes) SKIP_UIS=true ;;
+ *) SKIP_UIS=false ;;
+esac
+
for arg in "$@"; do
case "$arg" in
--only=*) ONLY_SVC="${arg#--only=}" ;;
+ --skip-uis) SKIP_UIS=true ;;
esac
done
@@ -91,32 +106,28 @@ warn() { echo -e "${YELLOW} WARN${NC} -- $*"; }
err() { echo -e "${RED} ERROR${NC} -- $*" >&2; }
# ---- Resolve the effective tag -------------------------------------------
-# The committed component is the single source of truth. MINIKUBE_IMAGE_TAG is
-# an operator lever applied to this run only, never a second writer.
-read_pinned_tag() {
- [ -f "$COMPONENT" ] || {
- err "ghcr component not found at ${COMPONENT}"
- exit 1
- }
- local tags
- tags="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/p' "$COMPONENT" | sort -u)"
- if [ -z "$tags" ]; then
- err "no newTag: line in ${COMPONENT}; there is no pin to pull"
- exit 1
- fi
- if [ "$(printf '%s\n' "$tags" | wc -l | tr -d ' ')" != "1" ]; then
- err "mixed newTag values in ${COMPONENT}: $(printf '%s ' $tags)"
- exit 1
- fi
- printf '%s' "$tags"
-}
+# THE TAG FOLLOWS THE CLUSTER, NOT JUST THE COMMIT. Reading the committed pin
+# here (with MINIKUBE_IMAGE_TAG as the only override) ignored the tag the last
+# acquisition actually recorded, so `make minikube-pull-images` on a cluster
+# bootstrapped with `MINIKUBE_IMAGE_TAG=latest` went and pulled the pinned
+# v0.6.0 -- which is 404 on ghcr until the tag is cut. That command is the
+# remedy the docs and this script's own failure text point people at, so it
+# failed precisely when someone followed the advice.
+#
+# image_mode_ghcr_tag applies override -> recorded -> pin, the same precedence
+# build-images.sh --verify-only and pre-gate-sync.sh already use. It is called
+# rather than image_mode_tag because pulling IS a ghcr acquisition: this script
+# records imageSource "ghcr" when it finishes, so a cluster whose current
+# record says "local" must still resolve a tag instead of an empty string.
+# shellcheck source=scripts/minikube/image-mode.sh
+source "${SCRIPT_DIR}/image-mode.sh"
-if [ -n "${MINIKUBE_IMAGE_TAG:-}" ]; then
- IMAGE_TAG="$MINIKUBE_IMAGE_TAG"
- TAG_ORIGIN="MINIKUBE_IMAGE_TAG override"
-else
- IMAGE_TAG="$(read_pinned_tag)"
- TAG_ORIGIN="committed pin in deploy/components/ghcr-images/kustomization.yaml"
+IMAGE_TAG="$(image_mode_ghcr_tag "$PROJECT_DIR")" || exit 1
+TAG_ORIGIN="$(image_mode_tag_origin "$PROJECT_DIR")" || exit 1
+if [ -z "$IMAGE_TAG" ] || [ -z "$TAG_ORIGIN" ]; then
+ err "could not resolve a ghcr tag to pull (tag='${IMAGE_TAG}' origin='${TAG_ORIGIN}')"
+ err "Set MINIKUBE_IMAGE_TAG=<tag> explicitly, or fix deploy/components/ghcr-images/kustomization.yaml."
+ exit 1
fi
# ---- Resolve the pull list ----------------------------------------------
@@ -140,6 +151,9 @@ fi
echo -e "\n${BOLD}=== Pulling Published Images (${IMAGE_TAG}) ===${NC}"
log "tag ${IMAGE_TAG} (${TAG_ORIGIN})"
log "profile ${PROFILE}, parallelism ${PULL_PARALLELISM}"
+if [ "$SKIP_UIS" = true ]; then
+ log "skipping control-ui and profile-ui (--skip-uis); the -no-uis overlay deletes both Deployments"
+fi
# ---- Point the Docker CLI at minikube's daemon when safe -----------------
if [ "$MINIKUBE_MULTI_NODE" = false ]; then
@@ -219,6 +233,14 @@ while IFS="$(printf '\t')" read -r name local_ref; do
if [ -n "$ONLY_SVC" ] && [[ "$name" != *"$ONLY_SVC"* ]] && [[ "$local_ref" != *"$ONLY_SVC"* ]]; then
continue
fi
+ # Exact names, not a substring: the -no-uis overlays delete exactly the
+ # control-ui and profile-ui workloads, and a looser match would silently drop
+ # any future image whose name happens to contain "ui".
+ if [ "$SKIP_UIS" = true ]; then
+ case "$name" in
+ control-ui | profile-ui) continue ;;
+ esac
+ fi
selected=$((selected + 1))
slot=$((slot + 1))
# Bounded concurrency without GNU parallel or `wait -n` (bash 3.2 on macOS).
diff --git a/scripts/tests/test-minikube-full-setup.sh b/scripts/tests/test-minikube-full-setup.sh
index ff625d1b6..814328b1d 100755
--- a/scripts/tests/test-minikube-full-setup.sh
+++ b/scripts/tests/test-minikube-full-setup.sh
@@ -383,6 +383,69 @@ full_setup_resolves() {
"$REPO_ROOT/scripts/minikube/full-setup.sh"
}
+# ---------------------------------------------------------------------------
+# A PROJECT_DIR whose recorded image manifest the test controls
+# ---------------------------------------------------------------------------
+#
+# full-setup.sh now resolves both the image MODE (on --skip-build) and the ghcr
+# TAG from deploy/minikube/.image-manifest.json, and it derives PROJECT_DIR from
+# its own location -- so the only way to hand it a chosen manifest is to run a
+# COPY of the script from a copied tree.
+#
+# That copy is not optional even for the cases that want no manifest at all:
+# the file is gitignored, so CI never has one and any machine that has run a
+# real `make minikube-setup` always does. Running against $REPO_ROOT would make
+# "does the banner print the committed pin?" answer differently on a laptop
+# than in CI. Every manifest-sensitive case below runs from a copy with the
+# manifest either removed or written explicitly.
+make_full_setup_copy() {
+ # make_full_setup_copy <dir> [manifest-json]
+ local d=$1 manifest=${2:-}
+ mkdir -p "$d/repo"
+ cp -R "$REPO_ROOT/deploy" "$d/repo/deploy"
+ cp -R "$REPO_ROOT/scripts" "$d/repo/scripts"
+ # `git init`, not decoration. full-setup.sh calls dotenv_canonical_root under
+ # `set -e`, and its last statement is `[[ -f .env ]] && printf` -- which
+ # returns 1, aborting the caller, when the tree is neither a git repo nor
+ # carries a .env. A plain copy is exactly that; a git checkout without a .env
+ # (which is what CI runs) takes the branch above it and returns 0. Initialising
+ # one here matches CI AND keeps the copy independent of whatever .env the
+ # developer's primary checkout happens to hold.
+ git init -q "$d/repo"
+ rm -f "$d/repo/deploy/minikube/.image-manifest.json"
+ if [ -n "$manifest" ]; then
+ mkdir -p "$d/repo/deploy/minikube"
+ printf '%s' "$manifest" > "$d/repo/deploy/minikube/.image-manifest.json"
+ fi
+}
+
+# The two fields image-mode.sh reads, in the shape both writers emit.
+recorded_manifest() {
+ # recorded_manifest <imageSource> <imageTag>
+ printf '{\n "generated": "2026-08-06T00:00:00Z",\n "profile": "clerum-test",\n "imageSource": "%s",\n "imageTag": "%s",\n "images": {}\n}\n' \
+ "$1" "$2"
+}
+
+# full_setup_copy_resolves <dir> <var> <flags> [env assignments...]
+# <flags> is the (unquoted, test-controlled) flag string handed to the sourced
+# script, e.g. --skip-build; pass '' for none.
+full_setup_copy_resolves() {
+ local d="$1" var="$2" flags="$3"; shift 3
+ env "$@" PATH="$FULL_SETUP_STUB_DIR:$PATH" MINIKUBE_FULL_SETUP_CONFIG_ONLY=true \
+ bash -c 'source "$0" '"$flags"' >/dev/null 2>&1; printf "%s" "${'"$var"'}"' \
+ "$d/repo/scripts/minikube/full-setup.sh"
+}
+
+# full_setup_copy_output <dir> <flags> [env assignments...] -- the banner and
+# warnings the run prints, which is what an operator actually sees.
+full_setup_copy_output() {
+ local d="$1" flags="$2"; shift 2
+ # $flags is a test-controlled literal, deliberately word-split.
+ # shellcheck disable=SC2086
+ env "$@" PATH="$FULL_SETUP_STUB_DIR:$PATH" MINIKUBE_FULL_SETUP_CONFIG_ONLY=true \
+ bash "$d/repo/scripts/minikube/full-setup.sh" $flags 2>&1
+}
+
assert_ghcr_is_the_default_image_source() {
local got
got="$(full_setup_resolves IMAGE_SOURCE)"
@@ -584,10 +647,16 @@ assert_the_skip_build_staleness_advice_is_mode_aware() {
# `full_setup_resolves` above) and asserts on the CAPTURED STDOUT the banner
# writes -- observed output, not source text -- so a deleted call site prints
# nothing and the assertion fails.
+#
+# Runs from a copy with NO recorded manifest (see make_full_setup_copy): the
+# tag now falls back to the committed pin only when nothing is recorded, and
+# the manifest is gitignored, so against $REPO_ROOT this case would assert the
+# pin in CI and the last-pulled tag on a developer machine.
assert_the_banner_prints_the_image_source_tag_and_origin() {
- local out committed_tag problem=""
- out="$(env PATH="$FULL_SETUP_STUB_DIR:$PATH" MINIKUBE_FULL_SETUP_CONFIG_ONLY=true \
- bash "$REPO_ROOT/scripts/minikube/full-setup.sh" 2>&1)"
+ local d out committed_tag problem=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d"
+ out="$(full_setup_copy_output "$d" '')"
committed_tag="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\).*$/\1/p' \
"$REPO_ROOT/deploy/components/ghcr-images/kustomization.yaml" | sort -u | head -1)"
grep -q 'Images: PULLED from ghcr.io/evenfire-ai' <<< "$out" || problem+="banner did not name the image source; "
@@ -598,17 +667,249 @@ assert_the_banner_prints_the_image_source_tag_and_origin() {
else
fail "$problem got: $out"
fi
+ rm -rf "$d"
}
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)"
+ local d pinned overridden
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d"
+ pinned="$(full_setup_copy_resolves "$d" TAG_ORIGIN '')"
+ overridden="$(full_setup_copy_resolves "$d" 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
+ rm -rf "$d"
+}
+
+# ---------------------------------------------------------------------------
+# THE MODE AND THE TAG FOLLOW THE CLUSTER
+# ---------------------------------------------------------------------------
+
+# FIX: --skip-build acquires nothing, so the overlay must follow the images
+# already on the node. Taking IMAGE_SOURCE instead rendered the -ghcr overlays
+# over a locally built cluster, pointing every Deployment at a ghcr ref nothing
+# had pulled. It is not a rare path: `make minikube-setup` ALWAYS passes
+# IMAGE_SOURCE=ghcr (the Makefile defaults it), which is exactly the value used
+# here.
+#
+# Semantic mutation coverage: `if false && [ "$SKIP_BUILD" = true ]`, or
+# swapping `!=` for `=` in the recorded-vs-requested comparison, or inverting
+# image_mode_source's `[ -n "$recorded" ]` -- each one puts the ghcr overlay
+# back and this fails.
+assert_skip_build_follows_the_recorded_image_source() {
+ local d render problems=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest local "")"
+ render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR --skip-build IMAGE_SOURCE=ghcr)"
+ [[ "$render" == */overlays/minikube ]] || problems+="a local-recorded cluster rendered '${render}'; "
+
+ # And the mirror image, so the fix cannot be "always render the local
+ # overlay": a ghcr-recorded cluster redeployed from an IMAGE_SOURCE=local
+ # shell must render the ghcr overlay.
+ rm -rf "$d"; d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest ghcr latest)"
+ render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR --skip-build IMAGE_SOURCE=local)"
+ [[ "$render" == */overlays/minikube-ghcr ]] || problems+="a ghcr-recorded cluster rendered '${render}'; "
+
+ if [ -z "$problems" ]; then
+ pass "--skip-build renders the overlay the cluster's recorded images need, in both directions"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# The operator has to be told, or a redeploy that quietly ignores IMAGE_SOURCE
+# is indistinguishable from one that honoured it.
+assert_skip_build_says_it_is_following_the_cluster() {
+ local d out problems=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest local "")"
+ out="$(full_setup_copy_output "$d" --skip-build IMAGE_SOURCE=ghcr)"
+ grep -q 'acquired as IMAGE_SOURCE=local' <<< "$out" || problems+="no warning naming the recorded mode; "
+ grep -q 'BUILT LOCALLY from source' <<< "$out" || problems+="the banner did not follow the recorded mode; "
+
+ # Silence when there is nothing to say: a matching mode must not warn, or the
+ # warning becomes noise everyone learns to ignore.
+ rm -rf "$d"; d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest ghcr latest)"
+ out="$(full_setup_copy_output "$d" --skip-build IMAGE_SOURCE=ghcr)"
+ grep -q 'acquired as IMAGE_SOURCE=' <<< "$out" && problems+="warned even though the modes agree; "
+
+ if [ -z "$problems" ]; then
+ pass "--skip-build warns when it overrides IMAGE_SOURCE, and stays quiet when it does not"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# The anti-regression for `make minikube-setup-local` over a pulled cluster: a
+# run that ACQUIRES images is about to rewrite the record, so the environment
+# still decides. Mutation: drop the `[ "$SKIP_BUILD" = true ]` guard and this
+# resolves ghcr from the record, making a mode switch impossible.
+assert_an_acquiring_run_still_honours_image_source() {
+ local d render problems=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest ghcr latest)"
+ render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR '' IMAGE_SOURCE=local)"
+ [[ "$render" == */overlays/minikube ]] || problems+="IMAGE_SOURCE=local over a ghcr record rendered '${render}'; "
+
+ rm -rf "$d"; d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest local "")"
+ render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR '' IMAGE_SOURCE=ghcr)"
+ [[ "$render" == */overlays/minikube-ghcr ]] || problems+="IMAGE_SOURCE=ghcr over a local record rendered '${render}'; "
+
+ if [ -z "$problems" ]; then
+ pass "a run that acquires images still honours IMAGE_SOURCE, so a cluster can change modes"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# The fresh-cluster path: on a FIRST run there is no manifest at all, so the
+# env default must still apply -- including under --skip-build. Mutation: make
+# image_mode_source ignore its env fallback and both halves break.
+assert_a_cluster_with_no_record_keeps_the_env_default() {
+ local d ghcr_render local_render problems=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d"
+ ghcr_render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR --skip-build)"
+ local_render="$(full_setup_copy_resolves "$d" ACTIVE_MINIKUBE_RENDER_DIR --skip-build IMAGE_SOURCE=local)"
+ [[ "$ghcr_render" == */overlays/minikube-ghcr ]] || problems+="default rendered '${ghcr_render}'; "
+ [[ "$local_render" == */overlays/minikube ]] || problems+="IMAGE_SOURCE=local rendered '${local_render}'; "
+ if [ -z "$problems" ]; then
+ pass "with nothing recorded, --skip-build still follows the IMAGE_SOURCE default and override"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# FIX: EFFECTIVE_IMAGE_TAG came from the committed pin and ignored the tag the
+# cluster recorded, so after the documented `MINIKUBE_IMAGE_TAG=latest make
+# minikube-setup` bootstrap every LATER run reported and acted on v0.6.0
+# against a cluster running :latest.
+#
+# Mutation coverage: swap the precedence in image_mode_ghcr_tag (pin before
+# record), or invert its `[ -n "$recorded" ]`, and this reads the pin.
+assert_the_effective_tag_comes_from_the_record_not_the_pin() {
+ local d tag origin pin problems=""
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest ghcr recorded-test-tag)"
+ tag="$(full_setup_copy_resolves "$d" EFFECTIVE_IMAGE_TAG '')"
+ origin="$(full_setup_copy_resolves "$d" TAG_ORIGIN '')"
+ pin="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\).*$/\1/p' \
+ "$REPO_ROOT/deploy/components/ghcr-images/kustomization.yaml" | sort -u | head -1)"
+ [ "$tag" = "recorded-test-tag" ] || problems+="EFFECTIVE_IMAGE_TAG was '${tag}', expected the recorded tag (pin is '${pin}'); "
+ grep -q 'deploy/minikube/.image-manifest.json' <<< "$origin" || problems+="TAG_ORIGIN was '${origin}', which does not name the manifest; "
+ if [ -z "$problems" ]; then
+ pass "EFFECTIVE_IMAGE_TAG is the tag the cluster recorded, and TAG_ORIGIN names the manifest"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# The floor and the override, so the precedence is pinned from both ends.
+assert_the_effective_tag_precedence_is_override_then_record_then_pin() {
+ local d pin from_pin from_override problems=""
+ pin="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\).*$/\1/p' \
+ "$REPO_ROOT/deploy/components/ghcr-images/kustomization.yaml" | sort -u | head -1)"
+ d="$(mktemp -d)"
+ make_full_setup_copy "$d"
+ from_pin="$(full_setup_copy_resolves "$d" EFFECTIVE_IMAGE_TAG '')"
+ [ -n "$pin" ] && [ "$from_pin" = "$pin" ] || problems+="with nothing recorded the tag was '${from_pin}', expected the pin '${pin}'; "
+
+ rm -rf "$d"; d="$(mktemp -d)"
+ make_full_setup_copy "$d" "$(recorded_manifest ghcr recorded-test-tag)"
+ from_override="$(full_setup_copy_resolves "$d" EFFECTIVE_IMAGE_TAG '' MINIKUBE_IMAGE_TAG=v9.9.9)"
+ [ "$from_override" = "v9.9.9" ] || problems+="MINIKUBE_IMAGE_TAG did not beat the record; got '${from_override}'; "
+
+ if [ -z "$problems" ]; then
+ pass "the effective tag is MINIKUBE_IMAGE_TAG, else the recorded tag, else the committed pin"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
+}
+
+# ---------------------------------------------------------------------------
+# --skip-uis reaches the PULL path
+# ---------------------------------------------------------------------------
+#
+# The -no-uis-ghcr overlay deletes both UI Deployments, so pulling control-ui
+# and profile-ui costs ~470 MiB for images nothing references. The local build
+# path has always passed --skip-uis through; the pull path did not.
+#
+# Step 5's ghcr arm needs a cluster to run, so the REAL arm is extracted and
+# eval'd with a stub pull-images.sh that records its argv. That is evaluated
+# behaviour, not a grep for the flag's name somewhere in the file: deleting the
+# `if [ "$SKIP_UIS" = true ]` guard, or inverting it, changes what the stub is
+# called with.
+extract_full_setup_pull_invocation() {
+ awk '
+ /log "Pulling published images/ { cap = 1 }
+ cap { print }
+ cap && /ok "All published images pulled"/ { exit }
+ ' "$1"
+}
+
+run_full_setup_pull_invocation() {
+ local d=$1 skip_uis=$2 script
+ mkdir -p "$d/bin"
+ cat > "$d/bin/pull-images.sh" <<'STUB'
+#!/usr/bin/env bash
+printf 'pull-images.sh %s\n' "$*" >>"${TEST_LOG_FILE:?}"
+exit 0
+STUB
+ chmod +x "$d/bin/pull-images.sh"
+ script="$d/pull-arm.sh"
+ {
+ printf 'set -euo pipefail\n'
+ printf 'log() { printf "LOG:%%s\\n" "$*"; }\n'
+ printf 'ok() { printf "OK:%%s\\n" "$*"; }\n'
+ printf 'SCRIPT_DIR=%q\n' "$d/bin"
+ printf 'PROFILE="clerum-test"\n'
+ printf 'EFFECTIVE_IMAGE_TAG="v0.0.0-test"\n'
+ printf 'SKIP_UIS=%q\n' "$skip_uis"
+ extract_full_setup_pull_invocation "$REPO_ROOT/scripts/minikube/full-setup.sh"
+ } > "$script"
+ TEST_LOG_FILE="$d/ops.log" bash "$script" 2>&1
+}
+
+assert_the_pull_path_forwards_skip_uis() {
+ local d out rc problems=""
+ d="$(mktemp -d)"
+ if [ -z "$(extract_full_setup_pull_invocation "$REPO_ROOT/scripts/minikube/full-setup.sh")" ]; then
+ fail "could not locate the ghcr pull invocation in full-setup.sh"
+ rm -rf "$d"
+ return
+ fi
+
+ out="$(run_full_setup_pull_invocation "$d" true)"; rc=$?
+ [ "$rc" -eq 0 ] || problems+="the extracted pull arm exited ${rc} with SKIP_UIS=true: ${out}; "
+ grep -q '^pull-images.sh --skip-uis$' "$d/ops.log" \
+ || problems+="SKIP_UIS=true did not forward --skip-uis (log: $(cat "$d/ops.log")); "
+
+ # The complement, so the fix cannot be "always pass --skip-uis". Also proves
+ # the empty-array expansion does not abort under `set -u`.
+ rm -rf "$d"; d="$(mktemp -d)"
+ out="$(run_full_setup_pull_invocation "$d" false)"; rc=$?
+ [ "$rc" -eq 0 ] || problems+="the extracted pull arm exited ${rc} with SKIP_UIS=false: ${out}; "
+ grep -q '^pull-images.sh $' "$d/ops.log" \
+ || problems+="SKIP_UIS=false did not call the puller with no flags (log: $(cat "$d/ops.log")); "
+
+ if [ -z "$problems" ]; then
+ pass "the ghcr pull path forwards --skip-uis only when SKIP_UIS is set (evaluated argv)"
+ else
+ fail "$problems"
+ fi
+ rm -rf "$d"
}
# ---------------------------------------------------------------------------
@@ -765,6 +1066,13 @@ assert_the_banner_prints_the_image_source_tag_and_origin
assert_the_tag_origin_distinguishes_pin_from_override
assert_the_tag_override_also_generates_the_api_ip_patch_in_the_working_tree
assert_the_unoverridden_path_generates_the_api_ip_patch_once
+assert_skip_build_follows_the_recorded_image_source
+assert_skip_build_says_it_is_following_the_cluster
+assert_an_acquiring_run_still_honours_image_source
+assert_a_cluster_with_no_record_keeps_the_env_default
+assert_the_effective_tag_comes_from_the_record_not_the_pin
+assert_the_effective_tag_precedence_is_override_then_record_then_pin
+assert_the_pull_path_forwards_skip_uis
assert_every_defined_case_is_invoked
exit $FAIL
diff --git a/scripts/tests/test-minikube-pull-images.sh b/scripts/tests/test-minikube-pull-images.sh
index d2b512e97..68f83302c 100755
--- a/scripts/tests/test-minikube-pull-images.sh
+++ b/scripts/tests/test-minikube-pull-images.sh
@@ -74,15 +74,40 @@ STUB
chmod +x "$d/bin/docker" "$d/bin/minikube"
}
-# Runs the script in an isolated PROJECT_DIR that is a copy of the real repo's
-# deploy/ + scripts/, so it reads the REAL deploy/images.json and the REAL
-# component pin rather than a fixture that could drift from them.
-run_puller() {
- local d=$1; shift
- make_stubs "$d"
+# Copies the real repo's deploy/ + scripts/ into an isolated PROJECT_DIR, so
+# every case reads the REAL deploy/images.json and the REAL component pin
+# rather than a fixture that could drift from them.
+#
+# deploy/minikube/.image-manifest.json is REMOVED from the copy unless a case
+# asks for one. It is gitignored, so CI never has it and a developer machine
+# that has run a real setup always does -- and since the puller now prefers the
+# RECORDED tag over the pin, leaving it in would make every pinned-tag case
+# here pass or fail depending on whose laptop it ran on.
+#
+# Usage: copy_repo <dir> [manifest-json]
+copy_repo() {
+ local d=$1 manifest=${2:-}
mkdir -p "$d/repo"
cp -R "$REPO_ROOT/deploy" "$d/repo/deploy"
cp -R "$REPO_ROOT/scripts" "$d/repo/scripts"
+ rm -f "$d/repo/deploy/minikube/.image-manifest.json"
+ if [ -n "$manifest" ]; then
+ mkdir -p "$d/repo/deploy/minikube"
+ printf '%s' "$manifest" > "$d/repo/deploy/minikube/.image-manifest.json"
+ fi
+}
+
+# What pull-images.sh and build-images.sh actually write, trimmed to the two
+# fields image-mode.sh reads. Usage: recorded_manifest <imageSource> <imageTag>
+recorded_manifest() {
+ printf '{\n "generated": "2026-08-06T00:00:00Z",\n "profile": "clerum-test",\n "imageSource": "%s",\n "imageTag": "%s",\n "images": {}\n}\n' \
+ "$1" "$2"
+}
+
+run_puller() {
+ local d=$1; shift
+ make_stubs "$d"
+ copy_repo "$d"
run_puller_prepared "$d" "$@"
}
@@ -193,9 +218,7 @@ assert_the_alias_honours_local_tag_and_local_name() {
local d out
d="$(mktemp -d)"
make_stubs "$d"
- mkdir -p "$d/repo"
- cp -R "$REPO_ROOT/deploy" "$d/repo/deploy"
- cp -R "$REPO_ROOT/scripts" "$d/repo/scripts"
+ copy_repo "$d"
# Append a published+deployed row whose local ref differs from its name in
# BOTH dimensions. node, not sed: the manifest is JSON and a text patch would
@@ -454,6 +477,192 @@ assert_a_partial_failure_says_the_tag_exists_and_advises_a_retry() {
rm -rf "$d"
}
+# ---------------------------------------------------------------------------
+# WHICH TAG THIS CLUSTER PULLS
+# ---------------------------------------------------------------------------
+# The puller used to read MINIKUBE_IMAGE_TAG else the committed pin, and never
+# the tag the last acquisition RECORDED. On the documented bootstrap
+# (`MINIKUBE_IMAGE_TAG=latest make minikube-setup`), a later
+# `make minikube-pull-images` therefore went looking for the pinned v0.6.0 --
+# which is 404 on ghcr until the tag is cut. That command is the remedy the
+# docs and this script's own failure text point people at, so it failed exactly
+# when someone followed the advice.
+
+# The committed pin, read from the real tree so this cannot drift the next time
+# a release is cut.
+committed_pin() {
+ sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/p' \
+ "$REPO_ROOT/deploy/components/ghcr-images/kustomization.yaml" | sort -u | head -1
+}
+
+# Mutation coverage: swap the precedence in image_mode_ghcr_tag so the pin is
+# consulted before the recorded value (or turn `[ -n "$recorded" ]` into
+# `[ -z "$recorded" ]`) and the pulled ref becomes the pin -- both asserted
+# here, in both directions.
+assert_the_recorded_tag_beats_the_committed_pin() {
+ local d out pin
+ d="$(mktemp -d)"
+ make_stubs "$d"
+ copy_repo "$d" "$(recorded_manifest ghcr recorded-test-tag)"
+ out="$(run_puller_prepared "$d" --only=control-api)"
+ pin="$(committed_pin)"
+ if grep -q '^pull ghcr\.io/evenfire-ai/control-api:recorded-test-tag$' "$d/ops.log" \
+ && ! grep -q "^pull ghcr\.io/evenfire-ai/control-api:${pin}\$" "$d/ops.log"; then
+ pass "the tag recorded by the last acquisition beats the committed pin"
+ else
+ fail "expected a pull at recorded-test-tag and none at the pin '${pin}': $out"
+ fi
+ rm -rf "$d"
+}
+
+# The other half of the precedence: an explicit override still wins over the
+# record, so an operator can move a cluster forward off a bad tag. Mutation:
+# reorder image_mode_ghcr_tag to consult the record first and this pulls
+# recorded-test-tag instead.
+assert_minikube_image_tag_beats_the_recorded_tag() {
+ local d out
+ d="$(mktemp -d)"
+ make_stubs "$d"
+ copy_repo "$d" "$(recorded_manifest ghcr recorded-test-tag)"
+ export MINIKUBE_IMAGE_TAG=override-test-tag
+ out="$(run_puller_prepared "$d" --only=control-api)"
+ unset MINIKUBE_IMAGE_TAG
+ if grep -q '^pull ghcr\.io/evenfire-ai/control-api:override-test-tag$' "$d/ops.log" \
+ && ! grep -q '^pull ghcr\.io/evenfire-ai/control-api:recorded-test-tag$' "$d/ops.log"; then
+ pass "MINIKUBE_IMAGE_TAG beats the recorded tag"
+ else
+ fail "expected a pull at override-test-tag and none at recorded-test-tag: $out"
+ fi
+ rm -rf "$d"
+}
+
+# The floor of the precedence, and the fresh-clone path: with nothing recorded
+# the committed pin is what gets pulled. Mutation: drop the pin fallback (or
+# return the empty recorded value) and the pull ref loses its tag entirely.
+assert_the_committed_pin_is_used_when_nothing_is_recorded() {
+ local d out pin
+ d="$(mktemp -d)"
+ pin="$(committed_pin)"
+ if [ -z "$pin" ]; then
+ fail "could not read the committed pin from the real component"
+ rm -rf "$d"
+ return
+ fi
+ out="$(run_puller "$d" --only=control-api)"
+ if grep -q "^pull ghcr\.io/evenfire-ai/control-api:${pin}\$" "$d/ops.log"; then
+ pass "with nothing recorded, the committed pin (${pin}) is what gets pulled"
+ else
+ fail "expected a pull at the committed pin '${pin}': $out"
+ fi
+ rm -rf "$d"
+}
+
+# Pulling IS a ghcr acquisition -- this script rewrites the manifest with
+# imageSource "ghcr" when it finishes -- so a cluster whose CURRENT record says
+# "local" must still resolve a tag. Routing this through image_mode_tag (which
+# gates on the recorded mode and returns empty for "local") instead of
+# image_mode_ghcr_tag makes `make minikube-pull-images` fail on exactly the
+# cluster an operator is trying to switch over to published images.
+#
+# Mutation: call image_mode_tag here instead and the run exits non-zero having
+# pulled nothing.
+assert_a_locally_built_cluster_still_resolves_a_tag_to_pull() {
+ local d out rc pin
+ d="$(mktemp -d)"
+ make_stubs "$d"
+ # What a full local build writes: mode local, and the ghcr coordinate cleared.
+ copy_repo "$d" "$(recorded_manifest local "")"
+ out="$(run_puller_prepared "$d" --only=control-api)"; rc=$?
+ pin="$(committed_pin)"
+ if [ "$rc" -eq 0 ] && grep -q "^pull ghcr\.io/evenfire-ai/control-api:${pin}\$" "$d/ops.log"; then
+ pass "a cluster recorded as locally built still pulls, at the committed pin"
+ else
+ fail "expected rc=0 and a pull at '${pin}' on a local-recorded cluster; got rc=$rc: $out"
+ fi
+ rm -rf "$d"
+}
+
+# An error that names the committed pin when the tag actually came from the
+# manifest sends the operator to edit a file that has no effect on the run.
+# Mutation: hardcode the pin wording in image_mode_tag_origin and the manifest
+# filename disappears from the failure text.
+assert_a_failure_names_the_manifest_when_the_tag_came_from_the_record() {
+ local d out rc
+ d="$(mktemp -d)"
+ make_stubs "$d"
+ copy_repo "$d" "$(recorded_manifest ghcr recorded-test-tag)"
+ export TEST_MISSING_TAGS="ghcr.io/evenfire-ai/control-api:recorded-test-tag"
+ export MINIKUBE_IMAGE_PULL_RETRIES=1
+ export MINIKUBE_IMAGE_PULL_DELAY_SECS=0
+ out="$(run_puller_prepared "$d" --only=control-api)"; rc=$?
+ unset TEST_MISSING_TAGS MINIKUBE_IMAGE_PULL_RETRIES MINIKUBE_IMAGE_PULL_DELAY_SECS
+ if [ "$rc" -ne 0 ] \
+ && grep -q "came from the tag recorded in deploy/minikube/.image-manifest.json" <<< "$out" \
+ && ! grep -q "came from the committed pin" <<< "$out"; then
+ pass "a failure at a recorded tag names the manifest, not the committed pin"
+ else
+ fail "expected the failure to name the recorded manifest as the tag origin; got rc=$rc: $out"
+ fi
+ rm -rf "$d"
+}
+
+# ---------------------------------------------------------------------------
+# --skip-uis
+# ---------------------------------------------------------------------------
+# The -no-uis-ghcr overlay DELETES the control-ui and profile-ui Deployments,
+# so pulling them spends ~470 MiB of transfer and disk on images no pod will
+# ever reference.
+
+# Mutation: `if false && [ "$SKIP_UIS" = true ]` around the filter, or `!=`
+# for `=`, and the two UI pulls reappear. The control-api half is what stops a
+# filter that drops everything from passing.
+assert_skip_uis_drops_the_ui_images_from_the_pull() {
+ local d out uis backend
+ d="$(mktemp -d)"
+ out="$(run_puller "$d" --skip-uis)"
+ uis="$(grep -cE '^pull ghcr\.io/evenfire-ai/(control-ui|profile-ui):' "$d/ops.log" || true)"
+ backend="$(grep -cE '^pull ghcr\.io/evenfire-ai/control-api:' "$d/ops.log" || true)"
+ if [ "$uis" -eq 0 ] && [ "$backend" -ge 1 ]; then
+ pass "--skip-uis pulls neither control-ui nor profile-ui, and still pulls the backend images"
+ else
+ fail "expected 0 UI pulls and >=1 control-api pull, got uis=$uis backend=$backend: $out"
+ fi
+ rm -rf "$d"
+}
+
+# The complement, so the filter cannot be "never pull the UIs".
+assert_the_uis_are_pulled_when_skip_uis_is_not_set() {
+ local d out uis
+ d="$(mktemp -d)"
+ out="$(run_puller "$d")"
+ uis="$(grep -cE '^pull ghcr\.io/evenfire-ai/(control-ui|profile-ui):' "$d/ops.log" || true)"
+ if [ "$uis" -eq 2 ]; then
+ pass "without --skip-uis both UI images are pulled"
+ else
+ fail "expected 2 UI pulls on the default path, got $uis: $out"
+ fi
+ rm -rf "$d"
+}
+
+# The env spelling full-setup.sh and build-images.sh already share. Mutation:
+# drop MINIKUBE_SKIP_UIS from the SKIP_UIS default and this pulls the UIs.
+assert_minikube_skip_uis_env_is_honoured() {
+ local d out uis
+ d="$(mktemp -d)"
+ make_stubs "$d"
+ copy_repo "$d"
+ export MINIKUBE_SKIP_UIS=true
+ out="$(run_puller_prepared "$d")"
+ unset MINIKUBE_SKIP_UIS
+ uis="$(grep -cE '^pull ghcr\.io/evenfire-ai/(control-ui|profile-ui):' "$d/ops.log" || true)"
+ if [ "$uis" -eq 0 ]; then
+ pass "MINIKUBE_SKIP_UIS=true drops the UI images without the flag"
+ else
+ fail "expected 0 UI pulls under MINIKUBE_SKIP_UIS=true, got $uis: $out"
+ fi
+ rm -rf "$d"
+}
+
assert_every_defined_case_is_invoked() {
local self defined invoked missing
self="$REPO_ROOT/scripts/tests/test-minikube-pull-images.sh"
@@ -481,6 +690,14 @@ assert_a_permanently_failing_pull_stops_after_the_retry_bound
assert_a_pull_failure_surfaces_the_captured_diagnostic_trimmed
assert_a_failure_at_the_latest_override_never_suggests_the_tag_that_just_failed
assert_a_partial_failure_says_the_tag_exists_and_advises_a_retry
+assert_the_recorded_tag_beats_the_committed_pin
+assert_minikube_image_tag_beats_the_recorded_tag
+assert_the_committed_pin_is_used_when_nothing_is_recorded
+assert_a_locally_built_cluster_still_resolves_a_tag_to_pull
+assert_a_failure_names_the_manifest_when_the_tag_came_from_the_record
+assert_skip_uis_drops_the_ui_images_from_the_pull
+assert_the_uis_are_pulled_when_skip_uis_is_not_set
+assert_minikube_skip_uis_env_is_honoured
assert_every_defined_case_is_invoked
exit $FAIL