Skip to content

Commit a030cde

Browse files
committed
Fix Docker tox-bootstrapd hash update failing when using BuildKit
Docker is defaulting to using BuildKit for building images since version 23.0 (2023-02-01), which is not compatible with this script. The script was fishing the hash of the intermediate build container in which the build has failed, in order to run the sha256sum in that image, however with BuildKit there are no longer any intermediate build containers, which breaks the script. The legacy builder is supposedly getting removed in a future version of Docker, which is why we embrace BuildKit instead of reverting to the legacy builder via DOCKER_BUILDKIT=0: $ DOCKER_BUILDKIT=0 docker build ... DEPRECATED: The legacy builder is deprecated and will be removed in a future release. BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0 environment-variable. While DOCKER_BUILDKIT=1 is unnecessary on Docker >= 23.0, it's needed for anyone running older Docker, so it makes sense to have it in for now, while everyone transitions.
1 parent 7cfe35d commit a030cde

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

other/bootstrap_daemon/docker/update-sha256

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eux
44

55
docker_build() {
6-
docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node .
6+
DOCKER_BUILDKIT=1 docker build --progress=plain -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node .
77
}
88

99
# Run Docker build once. If it succeeds, we're good.
@@ -12,12 +12,11 @@ if docker_build; then
1212
fi
1313

1414
# We're not good. Run it again, but now capture the output.
15-
OUTPUT=$(docker_build || true 2>&1)
15+
OUTPUT=$(docker_build 2>&1 || true)
1616

1717
if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then
1818
# This is a checksum warning, so we need to update it.
19-
IMAGE=$(echo "$OUTPUT" | grep '^ ---> [0-9a-f]*$' | grep -o '[0-9a-f]*$' | tail -n1)
20-
docker run --rm "$IMAGE" sha256sum /usr/local/bin/tox-bootstrapd >other/bootstrap_daemon/docker/tox-bootstrapd.sha256
19+
echo "$OUTPUT" | grep -Eo '[0-9a-f]{64} /usr/local/bin/tox-bootstrapd' | tail -n1 >other/bootstrap_daemon/docker/tox-bootstrapd.sha256
2120
fi
2221

2322
# Run once last time to complete the build.

0 commit comments

Comments
 (0)