Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(minikube): pass the inherited profile lock to the pre-gate full image build and re-pull
Alfredo Lopez7eeef4e20f9e
diff --git a/scripts/minikube/pre-gate-incremental.sh b/scripts/minikube/pre-gate-incremental.shindex 92b6ad466..0f6b294b4 100755--- a/scripts/minikube/pre-gate-incremental.sh+++ b/scripts/minikube/pre-gate-incremental.sh@@ -452,7 +452,9 @@ incremental_build_images() {log "Building all images because the change cannot be safely targeted"(cd "${PROJECT_DIR}"- make minikube-build-images+ # pre-gate-sync already holds the profile lock; the target's lock wrapper+ # must validate that lease instead of acquiring it again (PROFILE_BUSY).+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="${T2_LOCK_TOKEN}" make minikube-build-imagesmake minikube-verify-images)return 0@@ -486,7 +488,8 @@ incremental_build_images_ghcr() {log "Re-pulling the release image set (${IMAGE_TAG}) before shadowing the changed images"(cd "${PROJECT_DIR}"- make minikube-pull-images+ # Same inherited lease as the full local build above.+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="${T2_LOCK_TOKEN}" make minikube-pull-imagesmake minikube-verify-images)fidiff --git a/scripts/tests/test-minikube-pre-gate-shadow.sh b/scripts/tests/test-minikube-pre-gate-shadow.shindex 7f1f3d948..2f0a8b900 100755--- a/scripts/tests/test-minikube-pre-gate-shadow.sh+++ b/scripts/tests/test-minikube-pre-gate-shadow.sh@@ -402,6 +402,51 @@ assert_local_mode_still_builds_everything_on_a_full_image_build() {cleanup_fixture "$d"}+# pre-gate-sync acquires the profile lock itself before it sources this file.+# minikube-build-images and minikube-pull-images wrap their body in+# with-t2-mutation-lock.sh, which acquires the lock unless T2_SKIP_LOCK=true;+# called without the inherited lease they find the lock held by their own+# parent and refuse with PROFILE_BUSY. Both calls must pass the parent's lease,+# exactly as the minikube-deploy-crds / minikube-deploy-all calls do.+assert_full_image_calls_inherit_the_parent_profile_lock() {+ local d out_local out_ghcr rc_local rc_ghcr build_line pull_line+ d="$(mktemp -d)"+ prepare_repo "$d"+ cat > "$d/bin/make" <<'STUB'+#!/usr/bin/env bash+printf 'make %s T2_SKIP_LOCK=%s T2_LOCK_TOKEN=%s\n' "$*" "${T2_SKIP_LOCK:-}" "${T2_LOCK_TOKEN:-}" >>"${TEST_LOG_FILE:?}"+exit 0+STUB+ chmod +x "$d/bin/make"+ # The parent's state after t2_lock_acquire: it owns the lock, so its own+ # T2_SKIP_LOCK is empty and its token is exported.+ out_local="$(+ PATH="$d/bin:$PATH" TEST_LOG_FILE="$d/ops.log" \+ IMAGE_SOURCE=local IMAGE_TAG="" T2_SKIP_LOCK="" T2_LOCK_TOKEN="parent-lease-token" \+ run_incremental "$d" 'INCREMENTAL_FULL_IMAGE_BUILD=true; incremental_build_images'+ )"+ rc_local=$?+ out_ghcr="$(+ PATH="$d/bin:$PATH" TEST_LOG_FILE="$d/ops.log" \+ IMAGE_SOURCE=ghcr IMAGE_TAG="$PIN_TAG" T2_SKIP_LOCK="" T2_LOCK_TOKEN="parent-lease-token" \+ run_incremental "$d" 'INCREMENTAL_REPULL_ALL=true; INCREMENTAL_TARGETS=(); incremental_build_images'+ )"+ rc_ghcr=$?+ build_line="$(grep -c '^make minikube-build-images ' "$d/ops.log")"+ pull_line="$(grep -c '^make minikube-pull-images ' "$d/ops.log")"+ # Liveness: each lock-wrapped target was called exactly once. Only then does+ # the lease assertion mean anything.+ if [ "$rc_local" -eq 0 ] && [ "$rc_ghcr" -eq 0 ] \+ && [ "$build_line" = 1 ] && [ "$pull_line" = 1 ] \+ && grep -Fqx "make minikube-build-images T2_SKIP_LOCK=true T2_LOCK_TOKEN=parent-lease-token" "$d/ops.log" \+ && grep -Fqx "make minikube-pull-images T2_SKIP_LOCK=true T2_LOCK_TOKEN=parent-lease-token" "$d/ops.log"; then+ pass "full-image build and re-pull inherit the parent's profile lock"+ else+ fail "expected build/pull to carry T2_SKIP_LOCK=true and the parent token; rc_local=$rc_local rc_ghcr=$rc_ghcr log=$(cat "$d/ops.log") out_local=$out_local out_ghcr=$out_ghcr"+ fi+ cleanup_fixture "$d"+}+# An unmapped runtime path in ghcr mode is the one case the shadow cannot cover:# there is no image to build. Passing here would gate against undeployed code,# so it must stop, name the path, and name a remedy that works.@@ -1076,6 +1121,7 @@ assert_an_empty_shadow_set_is_reported_as_release_onlyassert_a_failed_retag_fails_the_pre_gateassert_a_full_sync_in_ghcr_mode_repulls_instead_of_building_everythingassert_local_mode_still_builds_everything_on_a_full_image_build+assert_full_image_calls_inherit_the_parent_profile_lockassert_an_unmapped_change_hard_fails_in_ghcr_mode_with_a_remedyassert_an_unresolvable_baseline_hard_fails_in_ghcr_modeassert_the_release_image_revision_label_supplies_the_missing_baseline