Skip to content

[ci] enable bazel strict action env by default#55985

Merged
aslonnie merged 1 commit intomasterfrom
lonnie-250826-alwaysstrict
Aug 28, 2025
Merged

[ci] enable bazel strict action env by default#55985
aslonnie merged 1 commit intomasterfrom
lonnie-250826-alwaysstrict

Conversation

@aslonnie
Copy link
Copy Markdown
Collaborator

so that action env vars are properly captured and sandboxed, makes caching working properly.

@aslonnie
Copy link
Copy Markdown
Collaborator Author

I am finally pulling the trigger~ @edoakes

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables Bazel's strict action environment by default, which is a great improvement for build caching and sandboxing. The changes in .bazelrc correctly apply the --incompatible_strict_action_env flag to builds, and the redundant flag is correctly removed from python/setup.py. I have one suggestion to improve the clarity of the .bazelrc configuration.

.bazelrc Outdated
# build --config=strict
# test --config=strict
build:strict --incompatible_strict_action_env
build --config=strict
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and clarity, it would be good to also add test --config=strict. While bazel test inherits options from bazel build, explicitly adding this makes the configuration more readable and consistent with the previous recommendation in the comments that were removed.

build --config=strict
test --config=strict

@aslonnie aslonnie force-pushed the lonnie-250826-alwaysstrict branch 3 times, most recently from 420d2a6 to 1504c80 Compare August 27, 2025 06:52
@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core devprod labels Aug 27, 2025
@aslonnie aslonnie force-pushed the lonnie-250826-alwaysstrict branch from 1504c80 to ca0e1ec Compare August 27, 2025 07:29
@aslonnie aslonnie added go add ONLY when ready to merge, run all tests and removed go add ONLY when ready to merge, run all tests labels Aug 27, 2025
@aslonnie
Copy link
Copy Markdown
Collaborator Author

seems that it does not work for all the python tests..

@aslonnie aslonnie marked this pull request as draft August 27, 2025 16:00
@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Aug 27, 2025

🚀

@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Aug 27, 2025

seems that it does not work for all the python tests..

LMK if I can help

@aslonnie
Copy link
Copy Markdown
Collaborator Author

aslonnie commented Aug 27, 2025

seems that sending in PATH works.. not ideal but better than capturing every single env var..

@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Aug 27, 2025
@aslonnie aslonnie force-pushed the lonnie-250826-alwaysstrict branch from c64aafc to 40526fd Compare August 27, 2025 18:48
@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Aug 27, 2025

seems that sending in PATH works.. not ideal but better than capturing every single env var..

Oof this might break a lot of flows though. For example if people use any tooling like conda that change the PATH

@aslonnie
Copy link
Copy Markdown
Collaborator Author

aslonnie commented Aug 27, 2025

Oof this might break a lot of flows though. For example if people use any tooling like conda that change the PATH

yep, I think your concern is totally legit... let me see if there are other ways.. I am just trying to see if this fixes the python tests.

I can probably also try symlink python and python3 in CI conda envs into /usr/local/bin before running python tests to make it work.. and might not need to capture PATH. I think the main thing is that bazel's py tests still need to be able to find the python from the system's conda env.

so that action env vars are properly captured and sandboxed,
makes caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
@aslonnie aslonnie force-pushed the lonnie-250826-alwaysstrict branch from 40526fd to 113099f Compare August 28, 2025 03:26
@aslonnie
Copy link
Copy Markdown
Collaborator Author

I can probably also try symlink python and python3 in CI conda envs

I ended up just pass --test_env=PATH on --config=ci for now. :-/

@aslonnie
Copy link
Copy Markdown
Collaborator Author

aslonnie commented Aug 28, 2025

running this on postmerge for a more comprehensive check: https://buildkite.com/ray-project/postmerge/builds/12552

and postmerge-macos: https://buildkite.com/ray-project/postmerge-macos/builds/7661

@aslonnie aslonnie marked this pull request as ready for review August 28, 2025 16:42
@aslonnie
Copy link
Copy Markdown
Collaborator Author

ready to merge @edoakes , please take a look.

# tests, which are all hermetic, can build, test and cache as intended, ray
# Python developers do not really use bazel test to run tests locally, but more
# often just run tests with "pytest" directly.
test:ci-base --test_env=PATH
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even when this is enabled, it only affects test (e.g. test result caching). it does not affect builds.

Copy link
Copy Markdown
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@aslonnie aslonnie merged commit 15d9d2d into master Aug 28, 2025
6 of 7 checks passed
@aslonnie aslonnie deleted the lonnie-250826-alwaysstrict branch August 28, 2025 16:59
tohtana pushed a commit to tohtana/ray that referenced this pull request Aug 29, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
tohtana pushed a commit to tohtana/ray that referenced this pull request Aug 29, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
gangsf pushed a commit to gangsf/ray that referenced this pull request Sep 2, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: Gang Zhao <gang@gang-JQ62HD2C37.local>
sampan-s-nayak pushed a commit to sampan-s-nayak/ray that referenced this pull request Sep 8, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: sampan <sampan@anyscale.com>
jugalshah291 pushed a commit to jugalshah291/ray_fork that referenced this pull request Sep 11, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: jugalshah291 <shah.jugal291@gmail.com>
wyhong3103 pushed a commit to wyhong3103/ray that referenced this pull request Sep 12, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: yenhong.wong <yenhong.wong@grabtaxi.com>
dstrodtman pushed a commit that referenced this pull request Oct 6, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
so that action env vars are properly captured and sandboxed, makes
caching working properly.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants