Skip to content

Commit f087e6e

Browse files
committed
Fix nix vendorHash computation and fail fast on errors
The Docker container hit a git safe.directory ownership check from libgit2, silently failing to compute the vendorHash. Two fixes: 1. Add git safe.directory config inside the container 2. Exit with error (not warning) when Docker is unavailable or hash extraction fails, so the release script stops early
1 parent a2b7568 commit f087e6e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/update-nix-flake.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ fi
3737

3838
if [[ "$NEED_HASH" == "true" ]]; then
3939
if ! command -v docker &>/dev/null; then
40-
echo " WARNING: Docker unavailable — cannot recompute vendorHash"
41-
echo " Run 'make update-nix-hash' after installing Docker"
40+
echo "ERROR: Docker unavailable — cannot recompute vendorHash"
41+
echo "Install Docker or run 'make update-nix-hash' manually."
42+
exit 1
4243
else
4344
echo " go.mod changed — computing vendorHash via Docker..."
4445
# Pin image digest for supply-chain integrity. Update periodically:
@@ -47,6 +48,7 @@ if [[ "$NEED_HASH" == "true" ]]; then
4748
BUILD_OUTPUT=$(docker run --rm -v "$(pwd):/src:ro" "$NIX_IMAGE" bash -c '
4849
cp -a /src /build && cd /build
4950
rm -rf .git
51+
git config --global --add safe.directory /build
5052
git init -q && git add -A && \
5153
GIT_COMMITTER_NAME=ci GIT_COMMITTER_EMAIL=ci@ci \
5254
GIT_AUTHOR_NAME=ci GIT_AUTHOR_EMAIL=ci@ci \
@@ -69,7 +71,9 @@ if [[ "$NEED_HASH" == "true" ]]; then
6971
elif echo "$BUILD_OUTPUT" | grep -q "building.*basecamp" ; then
7072
echo " vendorHash: verified (build succeeded)"
7173
else
72-
echo " WARNING: Could not determine vendorHash — check Docker output"
74+
echo "ERROR: Could not determine vendorHash from nix build output"
75+
echo "$BUILD_OUTPUT" | tail -20
76+
exit 1
7377
fi
7478
fi
7579
else

0 commit comments

Comments
 (0)