Skip to content

Commit 40ae488

Browse files
committed
Fix BuildKite's race condition on Amazon Linux
On our Amazon Linux 2 BuildKite setup, we run all tests without Docker to make the setup more closer to production. However runc uses `/run/runc` directory that would cause a race condition if we have multiple builds in parallel. This change adds `--root` parameter to runc to avoid the race condition. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent fffb1cd commit 40ae488

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.buildkite/setup_al2.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,17 @@ cat << EOF > $runtime_config_path
5353
EOF
5454

5555
cp ./runtime/firecracker-runc-config.json.example $dir/config.json
56-
cp ./_submodules/runc/runc $bin_path/runc
56+
57+
# runc uses /run/runc directory by default. Since our Amazon Linux 2 tests on
58+
# BuildKite don't use Docker, sharing the directory across multiple test
59+
# runs causes a race condition.
60+
#
61+
# This wrapper script gives runc /run/runc-$unique_id instead to avoid
62+
# the race condition.
63+
cp ./_submodules/runc/runc "$bin_path/runc.real"
64+
cat > "$bin_path/runc" <<EOF
65+
#! /bin/bash
66+
set -euo pipefail
67+
"$bin_path/runc.real" --root "/run/runc-$unique_id" "\$@"
68+
EOF
69+
chmod +x "$bin_path/runc"

0 commit comments

Comments
 (0)