Skip to content

Conversation

@andrew-anyscale
Copy link
Contributor

Adds new script push_ray_image.py for publishing Wanda-cached Ray images to Docker Hub.

Focus on this is replicating the tagging logic from ci/ray_ci/docker_container.py. Many test
cases were added to try to replicate the existing publishing cases, but it'll be good to hear
if any others would be helpful.

Topic: push-script
Signed-off-by: andrew [email protected]

Adds new script `push_ray_image.py` for publishing Wanda-cached Ray images to Docker Hub.

Focus on this is replicating the tagging logic from ci/ray_ci/docker_container.py. Many test
cases were added to try to replicate the existing publishing cases, but it'll be good to hear
if any others would be helpful.

Topic: push-script
Signed-off-by: andrew <[email protected]>
@andrew-anyscale
Copy link
Contributor Author

Reviews in this chain:
#60197 [ci] Add RayImagePushContext for publishing wanda Ray images
 └#59936 feat(ci): wanda ray image builds, uploads to Dockerhub
  └#59937 Add wanda anyscale image builds for release tests

@andrew-anyscale
Copy link
Contributor Author

andrew-anyscale commented Jan 16, 2026

# head base diff date summary
0 a0e25707 545eefc9 diff Jan 15 17:41 PM 3 files changed, 643 insertions(+)
1 06d411f4 545eefc9 diff Jan 15 18:02 PM 2 files changed, 33 insertions(+), 14 deletions(-)

Copy link
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 introduces a new script push_ray_image.py and its corresponding tests test_push_ray_image.py for publishing Wanda-cached Ray images to Docker Hub. The new RayImagePushContext class encapsulates the logic for generating image tags based on various parameters like branch, commit, Ray type, Python version, platform, and architecture. The accompanying tests are comprehensive and cover a wide range of scenarios, which is excellent for ensuring the correctness of the complex tagging logic. The Bazel build rules have also been updated to include the new binary and test.

One area for improvement is the use of assert statements for input validation in assert_published_image_type. While useful for development, assert statements are removed in optimized Python builds, which could lead to unexpected behavior if these validations are critical for the script's operation in a production environment.

Comment on lines 112 to 125
assert self.python_version in PYTHON_VERSIONS_RAY_ML, invalid_python_version
assert self.platform in PLATFORMS_RAY_ML, invalid_platform
assert self.architecture in ARCHITECTURES_RAY_ML, invalid_architecture
elif self.ray_type in [RayType.RAY_LLM, RayType.RAY_LLM_EXTRA]:
assert (
self.python_version in PYTHON_VERSIONS_RAY_LLM
), invalid_python_version
assert self.platform in PLATFORMS_RAY_LLM, invalid_platform
assert self.architecture in ARCHITECTURES_RAY_LLM, invalid_architecture
else:
# ray or ray-extra
assert self.python_version in PYTHON_VERSIONS_RAY, invalid_python_version
assert self.platform in PLATFORMS_RAY, invalid_platform
assert self.architecture in ARCHITECTURES_RAY, invalid_architecture
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using assert statements for input validation that relies on external parameters (like command-line arguments or environment variables) is not robust for production code. Python's assert statements are typically compiled out when running with the -O (optimize) flag, meaning these critical checks would be skipped. It's better to explicitly raise PushRayImageError for invalid inputs to ensure consistent behavior across all environments.

        if self.ray_type in [RayType.RAY_ML, RayType.RAY_ML_EXTRA]:
            if self.python_version not in PYTHON_VERSIONS_RAY_ML:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY_ML:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY_ML:
                raise PushRayImageError(invalid_architecture)
        elif self.ray_type in [RayType.RAY_LLM, RayType.RAY_LLM_EXTRA]:
            if self.python_version not in PYTHON_VERSIONS_RAY_LLM:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY_LLM:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY_LLM:
                raise PushRayImageError(invalid_architecture)
        else:
            # ray or ray-extra
            if self.python_version not in PYTHON_VERSIONS_RAY:
                raise PushRayImageError(invalid_python_version)
            if self.platform not in PLATFORMS_RAY:
                raise PushRayImageError(invalid_platform)
            if self.architecture not in ARCHITECTURES_RAY:
                raise PushRayImageError(invalid_architecture)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement

Huh TIL. I don't believe we're running in optimized mode today, but I'll use this anyways to start building that practice

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/push-script branch from a0e2570 to 06d411f Compare January 16, 2026 02:02
ctx = make_ctx(python_version="3.12", commit="abc123def456")
tags = ctx.destination_tags()
assert "abc123-py312-cpu" in tags
assert "build123-py312-cpu" in tags
Copy link

Choose a reason for hiding this comment

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

Test does not actually test feature branch behavior

Low Severity

The test_feature_branch_non_pr test claims to test "non-PR feature branch" behavior per its name and docstring, but it uses make_ctx(python_version="3.12", commit="abc123def456") without overriding the branch parameter. The default branch in make_ctx is "master", so this test actually exercises master branch behavior instead of feature branch behavior. The test passes coincidentally because both code paths return [sha_tag, rayci_build_id], but feature branch handling is not actually being validated.

Fix in Cursor Fix in Web

@ray-gardener ray-gardener bot added the devprod label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants