diff --git a/hack/migration-54-redis-adopt.bats b/hack/migration-54-redis-adopt.bats index 18fa8ce48..ec3281276 100644 --- a/hack/migration-54-redis-adopt.bats +++ b/hack/migration-54-redis-adopt.bats @@ -106,6 +106,25 @@ run_migration() { return "$_run_migration_rc" } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + # prep resets env to a clean scenario. Tests set FAKE_* afterwards. prep() { # Fail here rather than at the first docker run, so the reason is legible. @@ -115,12 +134,9 @@ prep() { echo "busybox ash — the interpreter run-migrations.sh actually gives it." >&2 return 1 } - # Bake jq onto the pinned base. Cached after the first run, so this is a no-op - # on every subsequent test; only the first build touches the network. - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FAKEBIN/kubectl" WORK=$(mktemp -d) export FAKE_CMDLOG="$WORK/cmdlog" diff --git a/hack/migration-55-fluxcd-orphan.bats b/hack/migration-55-fluxcd-orphan.bats index 92dd8475c..c5c337250 100644 --- a/hack/migration-55-fluxcd-orphan.bats +++ b/hack/migration-55-fluxcd-orphan.bats @@ -103,6 +103,25 @@ run_migration() { return "$_run_migration_rc" } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + # prep resets env to a clean scenario. Tests set FAKE_* afterwards. prep() { # Fail here rather than at the first docker run, so the reason is legible. @@ -112,12 +131,9 @@ prep() { echo "busybox ash — the interpreter run-migrations.sh actually gives it." >&2 return 1 } - # Bake jq onto the pinned base. Cached after the first run, so this is a no-op - # on every subsequent test; only the first build touches the network. - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FAKEBIN/kubectl" WORK=$(mktemp -d) export FAKE_CMDLOG="$WORK/cmdlog" diff --git a/hack/migration-57-seaweedfs-size-limit.bats b/hack/migration-57-seaweedfs-size-limit.bats index d2922def7..ccc1471b2 100644 --- a/hack/migration-57-seaweedfs-size-limit.bats +++ b/hack/migration-57-seaweedfs-size-limit.bats @@ -106,16 +106,34 @@ runbook_step() { return $? } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + prep() { docker info >/dev/null 2>&1 || { echo "docker is required: these tests run migration 57 inside a jq-enabled" >&2 echo "build of $ALPINE, the migrations image's base." >&2 return 1 } - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FAKEBIN/kubectl" WORK=$(mktemp -d) export FAKE_CMDLOG="$WORK/cmdlog" diff --git a/hack/migration-58-http-cache-freeze.bats b/hack/migration-58-http-cache-freeze.bats index 6f07d3b83..905139282 100644 --- a/hack/migration-58-http-cache-freeze.bats +++ b/hack/migration-58-http-cache-freeze.bats @@ -58,16 +58,34 @@ run_migration() { return "$_run_migration_rc" } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + prep() { docker info >/dev/null 2>&1 || { echo "docker is required: these tests run migration 58 inside a jq-enabled" >&2 echo "build of $ALPINE, the migrations image's base." >&2 return 1 } - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FAKEBIN/kubectl" mkdir -p "$WORKROOT" WORK=$(mktemp -d "$WORKROOT/XXXXXX") diff --git a/hack/migration-59-vmi-hotplug-volumes.bats b/hack/migration-59-vmi-hotplug-volumes.bats index 556061da2..d70cf4c97 100644 --- a/hack/migration-59-vmi-hotplug-volumes.bats +++ b/hack/migration-59-vmi-hotplug-volumes.bats @@ -48,16 +48,34 @@ run_migration() { return "$_run_migration_rc" } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + prep() { docker info >/dev/null 2>&1 || { echo "docker is required: these tests run migration 59 inside a jq-enabled" >&2 echo "build of $ALPINE, the migrations image's base." >&2 return 1 } - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FIXTURES/kubectl" mkdir -p "$WORKROOT" WORK=$(mktemp -d "$WORKROOT/XXXXXX") diff --git a/hack/migration-61-strimzi-v1-conversion.bats b/hack/migration-61-strimzi-v1-conversion.bats index 6b82dd5c7..946d15765 100644 --- a/hack/migration-61-strimzi-v1-conversion.bats +++ b/hack/migration-61-strimzi-v1-conversion.bats @@ -78,16 +78,34 @@ run_migration() { return "$_run_migration_rc" } +# build_test_image bakes the test's packages onto the pinned base. Its status +# is docker build's, so a failed build fails whoever called it. +build_test_image() { + docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || return 0 + build_test_image + return 0 +} + prep() { docker info >/dev/null 2>&1 || { echo "docker is required: these tests run migration 61 inside a jq-enabled" >&2 echo "build of $ALPINE, the migrations image's base." >&2 return 1 } - docker build -q -t "$TESTIMG" - >/dev/null </dev/null 2>&1 || build_test_image chmod +x "$FIXTURES/kubectl" mkdir -p "$WORKROOT" WORK=$(mktemp -d "$WORKROOT/XXXXXX")