summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Maennich <maennich@google.com>2023-11-23 00:55:00 +0000
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-01-17 21:29:21 +0000
commit14b583ac64884533ca75e3b5782454c019393591 (patch)
treeda3e9f3399c9637695501e1bfaf42d63b78b4be9
parent1750a21786d854b1dcbbb35b160211979bb6f9f7 (diff)
downloadbuild-14b583ac64884533ca75e3b5782454c019393591.tar.gz
kleaf: utils: adjust get_check_sandbox_cmd for compatibility with Bazel 8
As of bazel's e2c0276d1fd6 ("Enable `--incompatible_sandbox_hermetic_tmp` by default"), sandboxes can be much more neat, e.g. /tmp/bazel-working-directory/_main. Add support for that new behaviour when checking whether we are inside a sandbox. Link: https://github.com/bazelbuild/bazel/commit/e2c0276d1fd69c19d6946fb17f9e983e9ea68025 Bug: 319077326 Change-Id: I51498306fa620626d217dd89661c7acaba25560b Signed-off-by: Matthias Maennich <maennich@google.com> (cherry picked from commit 98b5f4865e13e39e5f6d973cf1f71752396073c3)
-rw-r--r--kleaf/impl/utils.bzl2
1 files changed, 1 insertions, 1 deletions
diff --git a/kleaf/impl/utils.bzl b/kleaf/impl/utils.bzl
index 545afbc7..95316534 100644
--- a/kleaf/impl/utils.bzl
+++ b/kleaf/impl/utils.bzl
@@ -166,7 +166,7 @@ def _get_check_sandbox_cmd():
Note: This is not always accurate."""
return """
- if [[ $PWD != */sandbox/* ]]; then
+ if [[ ! $PWD =~ /(sandbox|bazel-working-directory)/ ]]; then
echo "FATAL: this action must be executed in a sandbox!" >&2
exit 1
fi