Skip to content

Conversation

@israbbani
Copy link
Contributor

@israbbani israbbani commented Mar 18, 2025

Enable CI environment with writeable cgroupv2 in CI.

To use this environment for testing, you need to use the --privileged-container flag in your test definitions.
To enable bazel read/write to sys/fs/cgroup in your tests, you need to use the --build-type cgroup

1. Add support for privileged containers in linux_tester_container
2. Add cgroup bazel config for writable sandbox

Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani added the go add ONLY when ready to merge, run all tests label Mar 18, 2025
Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani removed the go add ONLY when ready to merge, run all tests label Mar 18, 2025
containers with --privilege enabled

Signed-off-by: Ibrahim Rabbani <[email protected]>
Signed-off-by: Ibrahim Rabbani <[email protected]>
Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani added go add ONLY when ready to merge, run all tests core Issues that should be addressed in Ray Core labels Mar 19, 2025
@israbbani israbbani added go add ONLY when ready to merge, run all tests and removed go add ONLY when ready to merge, run all tests labels Mar 19, 2025
Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani removed the go add ONLY when ready to merge, run all tests label Mar 19, 2025
Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani added the go add ONLY when ready to merge, run all tests label Mar 19, 2025
@israbbani israbbani changed the title [WIP] Cgroups in CI [ci] Enable Cgroup support in CI for core Mar 19, 2025
@israbbani israbbani marked this pull request as ready for review March 19, 2025 02:27
@israbbani israbbani requested a review from a team as a code owner March 19, 2025 02:27
@israbbani israbbani requested a review from aslonnie March 19, 2025 02:27
build:ubsan --linkopt -fno-sanitize-recover=all
build:ubsan --per_file_copt="-external/com_github_grpc_grpc/.*@-fsanitize=undefined"

build:cgroup --sandbox_writable_path=/sys/fs/cgroup --config=llvm
Copy link
Contributor

Choose a reason for hiding this comment

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

curious what is --config=llvm?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it means inherit build:llvm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's defined in .bazelrc file. I'm not sure if this is the right one for what we want. @aslonnie maybe --config=clang is better because it's consistent with our other cpp tests?

Copy link
Collaborator

Choose a reason for hiding this comment

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

rename can happen in another follow up.

@israbbani maybe checkin the change of this .bazelrc file first (and I can approve it), and then your iteration on this PR can have much better cache hit rate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for some reason the cache hit rate has improved on its own. Maybe one of the microchecks passed and published the docker image?

Copy link
Contributor

Choose a reason for hiding this comment

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

it means inherit build:llvm

Sorry for the confusion, my real question is why do we need the config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aslonnie asked me to include it as the base config for C++ testing. It adds the following properties:

# LLVM (clang & libc++) build flags common across Linux installations and systems.
# On Ubuntu, the remaining configurations can be generated by running ci/env/install-llvm-binaries.sh
build:llvm --action_env=CXXFLAGS=-stdlib=libc++
build:llvm --action_env=LDFLAGS=-stdlib=libc++
build:llvm --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:llvm --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a
build:llvm --action_env=BAZEL_LINKOPTS=-lm:-pthread
build:llvm --define force_libcpp=enabled

My understanding is that it's needed if we're going to use the cgroup config to run C++ tests. Are you asking why we need the cgroup config?

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you asking why we need the cgroup config?

No, I'm just curious why do we need these llvm config.
Because I don't see it in all C++ related configs, for example

ray/.bazelrc

Lines 128 to 134 in 5e05c2f

build:asan --strip=never
build:asan --copt -g
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
build:asan --no//:jemalloc_flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good question. We may need to audit these and removes one that we don't need.

@israbbani israbbani requested a review from aslonnie March 20, 2025 23:38
@israbbani
Copy link
Contributor Author

Alright. I've addressed the comments and I did manual verification. I think this is good to go. @aslonnie PTAL.

Signed-off-by: Ibrahim Rabbani <[email protected]>
Comment on lines 115 to 116
if self.privileged:
command.append("--privileged")
Copy link
Collaborator

Choose a reason for hiding this comment

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

why it needs to be added at this location? this split of command feels a bit weird..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was having trouble getting it to work if the --privileged flag was at the end of the command. It works now so it must've been another problem. I moved it back

@israbbani israbbani removed the go add ONLY when ready to merge, run all tests label Mar 24, 2025
Signed-off-by: Ibrahim Rabbani <[email protected]>
Signed-off-by: Ibrahim Rabbani <[email protected]>
@israbbani israbbani added the go add ONLY when ready to merge, run all tests label Mar 24, 2025
@israbbani israbbani requested review from aslonnie and dentiny March 24, 2025 20:40
Copy link
Contributor

@dentiny dentiny left a comment

Choose a reason for hiding this comment

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

Thank you so much for the amazing work!

Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

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


via GIPHY

@aslonnie aslonnie merged commit e662459 into master Mar 24, 2025
6 checks passed
@aslonnie aslonnie deleted the irabbani/ci-adventures branch March 24, 2025 22:35
dentiny pushed a commit to dentiny/ray that referenced this pull request Mar 25, 2025
Enable CI environment with writeable cgroupv2 in CI. 

To use this environment for testing, you need to use the
`--privileged-container` flag in your test definitions.
To enable bazel read/write to sys/fs/cgroup in your tests, you need to
use the `--build-type cgroup`

---------

Signed-off-by: Ibrahim Rabbani <[email protected]>
dhakshin32 pushed a commit to dhakshin32/ray that referenced this pull request Mar 27, 2025
Enable CI environment with writeable cgroupv2 in CI.

To use this environment for testing, you need to use the
`--privileged-container` flag in your test definitions.
To enable bazel read/write to sys/fs/cgroup in your tests, you need to
use the `--build-type cgroup`

---------

Signed-off-by: Ibrahim Rabbani <[email protected]>
Signed-off-by: Dhakshin Suriakannu <[email protected]>
srinathk10 pushed a commit that referenced this pull request Mar 28, 2025
Enable CI environment with writeable cgroupv2 in CI.

To use this environment for testing, you need to use the
`--privileged-container` flag in your test definitions.
To enable bazel read/write to sys/fs/cgroup in your tests, you need to
use the `--build-type cgroup`

---------

Signed-off-by: Ibrahim Rabbani <[email protected]>
Signed-off-by: Srinath Krishnamachari <[email protected]>
Copy link
Contributor

@dentiny dentiny left a comment

Choose a reason for hiding this comment

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

Some post-merge comments (correct me if wrong):

  • We need to have documentation on how cgroup tests could be enabled in CI, because it's different with normal C++ tests;
  • It looks to me we need to filter cgroup tests out for normal C++ tests by tags, and enable cgroup tests by tags (using --only-tags)

@dentiny
Copy link
Contributor

dentiny commented Mar 31, 2025

Some post-merge comments (correct me if wrong):

I could make updates if that sounds reasonable to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants