From 164ca68bcd5ff3065a8f79353a99a479fd066bc2 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Wed, 22 Jun 2022 17:06:28 -0700 Subject: [PATCH] gVisor BuildKite `pre-command`: Clean Docker `RUNTIME` to not contain slashes. Slashes in Docker runtime names break Docker. PiperOrigin-RevId: 456642822 --- .buildkite/hooks/pre-command | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index a64a82e73..c4f6da378 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -31,7 +31,10 @@ PARTITION=$((${PARTITION}+1)) # 1-indexed, but PARALLEL_JOB is 0-indexed. export TOTAL_PARTITIONS=${BUILDKITE_PARALLEL_JOB_COUNT:-1} # Set the system-wide Docker runtime name after the BuildKite branch name. -export RUNTIME="${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_ID}" +# Remove any slashes and other characters that are not supported in Docker +# runtime names. The runtime name must be a single valid path component. +export RUNTIME="buildkite_runtime_${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_ID}" +export RUNTIME="$(echo "$RUNTIME" | sed -r 's~[^-_a-z0-9]+~_~g')" # Ensure Docker has experimental enabled. if [[ -n "${STAGED_BINARIES:-}" ]]; then