From d5e074d7187ab884175f727039c5e0dd579d4db0 Mon Sep 17 00:00:00 2001 From: Luke Okraszewski Date: Wed, 11 Sep 2024 14:51:55 +0100 Subject: [PATCH 1/3] Allow build/test on the entire repo Clean up constraints and CI to allow running all targets without the need to exclude subtrees based on platform. --- README.md | 8 ++++---- docker/sysbox/dind_test/BUILD | 1 + infra/test-all.py | 16 ++-------------- platform/linux_x64/BUILD | 3 +++ platform/windows_x64/BUILD | 3 +++ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 75121f28..44799218 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ locally before attempting remote execution. Build them all with: ```sh - bazel build -- //... -//platform/... + bazel build //... ``` - `swift`: @@ -78,7 +78,7 @@ locally before attempting remote execution. Test them all with: ```sh - bazel test -- //... -//platform/... + bazel test //... ``` - `swift`: @@ -130,7 +130,7 @@ build --config=engflow Build them all with: ```sh - bazel build -- //... -//platform/... + bazel build //... ``` - `swift`: @@ -150,7 +150,7 @@ build --config=engflow Test them all with: ```sh - bazel test -- //... -//platform/... + bazel test //... ``` - `swift`: diff --git a/docker/sysbox/dind_test/BUILD b/docker/sysbox/dind_test/BUILD index 90b40b97..142afd56 100644 --- a/docker/sysbox/dind_test/BUILD +++ b/docker/sysbox/dind_test/BUILD @@ -28,4 +28,5 @@ sh_test( # DO NOT ENABLE!!! "dockerPrivileged": "True", # sysbox containers will refuse to start }, + tags = ["manual"] ) \ No newline at end of file diff --git a/infra/test-all.py b/infra/test-all.py index a7c04654..b27b7251 100644 --- a/infra/test-all.py +++ b/infra/test-all.py @@ -7,19 +7,7 @@ def main(): # All targets that can run in any environment. targets = [ - "//cpp/...", - "//docker/network/...", - "//docker/sandbox/...", - "//genrules/...", - "//go/...", - "//java/...", - "//kotlin/...", - "//scala/...", - "//typescript/...", - "//csharp/...", - "//perl/...", - "//python/...", - "//swift/...", + "//...", ] for key in ("ARCH", "OPAL_RPC_CREDENTIALS", "OS", "REMOTE_EXECUTION"): @@ -42,7 +30,7 @@ def main(): ] # The //docker/sysbox/... targets should only run in linux + remote if os.getenv("REMOTE_EXECUTION") == "true" and os.getenv("OS") == "linux": - targets += ["//docker/sysbox/...",] + targets += ["//docker/sysbox:check_docker",] args = ["bazel", "test"] + flags + ["--"] + targets result = subprocess.run(args) diff --git a/platform/linux_x64/BUILD b/platform/linux_x64/BUILD index 72237f89..d8805818 100644 --- a/platform/linux_x64/BUILD +++ b/platform/linux_x64/BUILD @@ -37,6 +37,9 @@ cc_toolchain_suite( "k8|clang": ":cc-compiler-k8", "k8": ":cc-compiler-k8", }, + target_compatible_with = [ + "@platforms//os:linux", + ], ) cc_toolchain( diff --git a/platform/windows_x64/BUILD b/platform/windows_x64/BUILD index dced707a..d52c1a56 100644 --- a/platform/windows_x64/BUILD +++ b/platform/windows_x64/BUILD @@ -39,6 +39,9 @@ cc_toolchain_suite( "x64_windows|msvc": ":msvc_cc_toolchain", "x64_windows": ":msvc_cc_toolchain", }, + target_compatible_with = [ + "@platforms//os:windows", + ], ) cc_toolchain( From 3bc909c84575da2938f54afa87a7273cce37437e Mon Sep 17 00:00:00 2001 From: Luke Okraszewski Date: Wed, 11 Sep 2024 14:57:57 +0100 Subject: [PATCH 2/3] Fix up newline --- docker/sysbox/dind_test/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/sysbox/dind_test/BUILD b/docker/sysbox/dind_test/BUILD index 142afd56..be94eb9b 100644 --- a/docker/sysbox/dind_test/BUILD +++ b/docker/sysbox/dind_test/BUILD @@ -29,4 +29,4 @@ sh_test( # sysbox containers will refuse to start }, tags = ["manual"] -) \ No newline at end of file +) From 52c174a5e6ac661be96490c733c3f0aaa907053f Mon Sep 17 00:00:00 2001 From: Luke Okraszewski Date: Wed, 11 Sep 2024 15:11:27 +0100 Subject: [PATCH 3/3] Fix up dind target pattern Update docs to match. --- docker/sysbox/README.md | 6 +++--- infra/test-all.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/sysbox/README.md b/docker/sysbox/README.md index 98ee88f9..2b9fc4bb 100644 --- a/docker/sysbox/README.md +++ b/docker/sysbox/README.md @@ -11,14 +11,14 @@ Usage: a container tha uses `sysbox` to run nested docker containers. - Modify the `dind_test/BUILD`. Change the `container-image` attribute of the `sh_test` -rule to point the container you produced in the previous step. +rule to point the container you produced in the previous step. -- Modify the `.bazelrc` file at the top level of the repo to use your own endpoint. +- Modify the `.bazelrc` file at the top level of the repo to use your own endpoint. - Run the following command: ```sh -bazel test --config= --test_output=all //docker/sysbox/dind_test/... +bazel test --config= --test_output=all //docker/sysbox/dind_test:check_docker ``` # How does it work? diff --git a/infra/test-all.py b/infra/test-all.py index b27b7251..bc3c3ef2 100644 --- a/infra/test-all.py +++ b/infra/test-all.py @@ -30,7 +30,7 @@ def main(): ] # The //docker/sysbox/... targets should only run in linux + remote if os.getenv("REMOTE_EXECUTION") == "true" and os.getenv("OS") == "linux": - targets += ["//docker/sysbox:check_docker",] + targets += ["//docker/sysbox/dind_test:check_docker",] args = ["bazel", "test"] + flags + ["--"] + targets result = subprocess.run(args)