ci(provenance): opt-in immutable Node builder and runtime base with temporary Dockerfile only

This commit is contained in:
victorsteele428 committed 2026-11-23 17:37:32 +00:00
1 parent 8b8a5c6bae
commit 5c9fd4ab4b
1 file changed
+35 -1
+35 -1
View File
@@ -21,8 +21,24 @@ fi
test -r auth/ui/v2/apps/login/Dockerfile
test -r auth/ui/v2/pnpm-lock.yaml
test -r tests/ci/oidc_e2e/cleanup.sh
# P05-OIDC-10 is opt-in: the previously accepted Run #99/default build mode
# is not changed. The frozen input lock is read only in this new workflow.
case "${ZITPLANE_PROVENANCE_CI:-0}" in
0|1) ;;
*) echo ZITPLANE_P10_INVALID_PROVENANCE_MODE >&2; exit 1 ;;
esac
if [ "${ZITPLANE_PROVENANCE_CI:-0}" = 1 ]; then
python3 tests/ci/login_image/provenance.py --preflight
builder_ref="$(python3 tests/ci/login_image/provenance.py --field builder_ref)"
else
builder_ref=node:22-bookworm
fi
echo ZITPLANE_CUSTOM_LOGIN_ISOLATED_BUILD_PREFLIGHT_PASS
docker create --name "$builder" --label "$label" node:22-bookworm sleep 3600 >/dev/null
if [ "${ZITPLANE_PROVENANCE_CI:-0}" = 1 ]; then
docker create --platform linux/amd64 --name "$builder" --label "$label" "$builder_ref" sleep 3600 >/dev/null
else
docker create --name "$builder" --label "$label" "$builder_ref" sleep 3600 >/dev/null
fi
docker start "$builder" >/dev/null
docker exec "$builder" mkdir -p /work
docker cp auth/ui/v2 "$builder:/work/v2"
@@ -82,7 +98,21 @@ esac
}
echo ZITPLANE_CUSTOM_LOGIN_ENTRYPOINT_COPY_EXECUTABLE_PASS
cp auth/ui/v2/apps/login/Dockerfile "$context/Dockerfile"
if [ "${ZITPLANE_PROVENANCE_CI:-0}" = 1 ]; then
python3 tests/ci/login_image/provenance.py --pin-dockerfile "$context/Dockerfile"
source_revision="$(git rev-parse HEAD)"
source_tree="$(git rev-parse HEAD:auth/ui/v2)"
builder_index="$(python3 tests/ci/login_image/provenance.py --field builder_index)"
runtime_index="$(python3 tests/ci/login_image/provenance.py --field runtime_index)"
docker build --pull --platform linux/amd64 --label "$label" \
--label "org.opencontainers.image.revision=$source_revision" \
--label "zitplane.login.source_tree=$source_tree" \
--label "zitplane.login.builder_digest=$builder_index" \
--label "zitplane.login.runtime_digest=$runtime_index" \
-t "$image" -f "$context/Dockerfile" "$context"
else
docker build --pull --label "$label" -t "$image" -f "$context/Dockerfile" "$context"
fi
# Probe the final image under its original USER nextjs, with no network,
# credentials, host volumes or entrypoint execution; print no file contents.
docker run --rm --network none --entrypoint /bin/sh "$image" -ec '
@@ -105,3 +135,7 @@ case "$image_id" in sha256:*) ;; *) echo ZITPLANE_CUSTOM_LOGIN_IMAGE_ID_MISSING
echo ZITPLANE_CUSTOM_LOGIN_LOCAL_IMAGE_BUILT_PASS
# Record only a digest/ID and sanitized ownership metadata (never credentials).
echo "ZITPLANE_CUSTOM_LOGIN_IMAGE_ID=$image_id"
if [ "${ZITPLANE_PROVENANCE_CI:-0}" = 1 ]; then
python3 tests/ci/login_image/provenance.py --verify-image
echo ZITPLANE_P10_LOCAL_DISPOSABLE_IMAGE_PROVENANCE_PASS
fi