From 433631717eaa4909c8daab2759a5322f29c085fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Tue, 7 Nov 2023 14:00:57 +0100 Subject: [PATCH] ci: add option to use a different Firecracker binary --- .buildkite/common.py | 7 +++++++ .buildkite/pipeline_pr.py | 14 +++++++++++++- tests/conftest.py | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.buildkite/common.py b/.buildkite/common.py index 5bafa4810d51..154d9b613e77 100644 --- a/.buildkite/common.py +++ b/.buildkite/common.py @@ -159,3 +159,10 @@ def __call__(self, parser, namespace, value, option_string=None): default={}, type=str, ) +COMMON_PARSER.add_argument( + "--binary-dir", + help="Use the Firecracker binaries from this path", + required=False, + default=None, + type=str, +) diff --git a/.buildkite/pipeline_pr.py b/.buildkite/pipeline_pr.py index 40d3eb5b31ce..3c372b60a13c 100755 --- a/.buildkite/pipeline_pr.py +++ b/.buildkite/pipeline_pr.py @@ -41,6 +41,18 @@ defaults_once_per_architecture["platforms"] = [("al2", "linux_5.10")] +def devtool_test(cmd, binary_dir=None): + cmds = [] + parts = ["./tools/devtool -y test --"] + if binary_dir is not None: + cmds.append(f"buildkite-agent artifact download \"{binary_dir}/$(uname -m)/*\" .") + cmds.append(f"chmod -v a+x {binary_dir}/**/*") + parts.append(f"--binary-dir=../{binary_dir}/$(uname -m)") + parts.append(cmd) + cmds.append(" ".join(parts)) + return cmds + + devctr_grp = group( "🐋 Dev Container Sanity Build", "./tools/devtool -y build_devctr", @@ -61,7 +73,7 @@ functional_grp = group( "⚙ Functional and security 🔒", - "./tools/devtool -y test -- -n 8 --dist worksteal integration_tests/{{functional,security}}", + devtool_test("-n 8 --dist worksteal integration_tests/{{functional,security}}", args.binary_dir), **defaults, ) diff --git a/tests/conftest.py b/tests/conftest.py index ced61be0f0f8..180e2faf7c2f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -288,6 +288,8 @@ def microvm_factory(fc_tmp_path, bin_cloner_path, request): if binary_dir := request.config.getoption("--binary-dir"): fc_binary_path = Path(binary_dir) / "firecracker" jailer_binary_path = Path(binary_dir) / "jailer" + if not fc_binary_path.exists(): + raise RuntimeError("Firecracker binary does not exist") else: fc_binary_path, jailer_binary_path = build_tools.get_firecracker_binaries()