From a19366b16523e3d6fbe89d66fb6eca7ddf47c075 Mon Sep 17 00:00:00 2001 From: Markus Hofbauer Date: Thu, 28 Aug 2025 15:45:15 +0200 Subject: [PATCH 1/2] Set incompatible_strict_action_env and announce_rc in CI --- .bazelci/presubmit.yml | 1 + .bazelrc | 2 ++ examples/bzlmod/.bazelrc | 1 + tests/integration/custom_commands_test.py | 1 - tests/integration/runner.py | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 5889823d3d..fbe881d435 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -34,6 +34,7 @@ buildifier: build_flags: - "--keep_going" - "--build_tag_filters=-integration-test" + - "--announce_rc" test_targets: - "--" - "..." diff --git a/.bazelrc b/.bazelrc index d7e1771336..076a7005dd 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,6 +20,8 @@ build --incompatible_default_to_explicit_init_py # Ensure ongoing compatibility with this flag. common --incompatible_disallow_struct_provider_syntax +common --incompatible_strict_action_env + # Windows makes use of runfiles for some rules build --enable_runfiles diff --git a/examples/bzlmod/.bazelrc b/examples/bzlmod/.bazelrc index ca83047ccc..25fc442c81 100644 --- a/examples/bzlmod/.bazelrc +++ b/examples/bzlmod/.bazelrc @@ -7,4 +7,5 @@ test --test_output=errors --enable_runfiles # Windows requires these for multi-python support: build --enable_runfiles +build --incompatible_strict_action_env common:bazel7.x --incompatible_python_disallow_native_rules diff --git a/tests/integration/custom_commands_test.py b/tests/integration/custom_commands_test.py index 2e9cb741b0..da967526fc 100644 --- a/tests/integration/custom_commands_test.py +++ b/tests/integration/custom_commands_test.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging import unittest from tests.integration import runner diff --git a/tests/integration/runner.py b/tests/integration/runner.py index 2534ab2d90..7fcf5de1a4 100644 --- a/tests/integration/runner.py +++ b/tests/integration/runner.py @@ -82,6 +82,7 @@ def setUp(self): self.tmp_dir = outer_test_tmpdir / "bit_tmp" self.bazel_env = { "PATH": os.environ["PATH"], + "HOME": os.environ["HOME"], "TEST_TMPDIR": str(self.test_tmp_dir), "TMP": str(self.tmp_dir), # For some reason, this is necessary for Bazel 6.4 to work. From bde22bffe82ba5fd87799ddedb67ba118ab0a9d5 Mon Sep 17 00:00:00 2001 From: Markus Hofbauer Date: Mon, 15 Sep 2025 09:11:17 +0200 Subject: [PATCH 2/2] pass action env --- .bazelci/presubmit.yml | 2 ++ tests/integration/custom_commands_test.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index fbe881d435..9bac76f14a 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -523,6 +523,8 @@ tasks: platform: windows build_targets: ["//tests/integration:local_toolchains_test_bazel_self"] test_targets: ["//tests/integration:local_toolchains_test_bazel_self"] + build_flags: + - "--action_env=PATH" integration_test_compile_pip_requirements_ubuntu: <<: *reusable_build_test_all diff --git a/tests/integration/custom_commands_test.py b/tests/integration/custom_commands_test.py index da967526fc..e028ebac50 100644 --- a/tests/integration/custom_commands_test.py +++ b/tests/integration/custom_commands_test.py @@ -20,7 +20,9 @@ class CustomCommandsTest(runner.TestCase): # Regression test for https://github.com/bazel-contrib/rules_python/issues/1840 def test_run_build_python_zip_false(self): - result = self.run_bazel("run", "--build_python_zip=false", "//:bin") + result = self.run_bazel( + "run", "--build_python_zip=false", "--action_env=PATH", "//:bin" + ) self.assert_result_matches(result, "bazel-out")