Skip to content

[CI] Add format_platform_tag and build_platform_reverse_map to supported_images#62200

Closed
andrew-anyscale wants to merge 2 commits intoandrew/revup/master/rayci-39from
andrew/revup/master/shared-lib
Closed

[CI] Add format_platform_tag and build_platform_reverse_map to supported_images#62200
andrew-anyscale wants to merge 2 commits intoandrew/revup/master/rayci-39from
andrew/revup/master/shared-lib

Conversation

@andrew-anyscale
Copy link
Copy Markdown
Contributor

@andrew-anyscale andrew-anyscale commented Mar 30, 2026

Move format_platform_tag() from image_tags_lib.py to supported_images.py (zero external deps) and add build_platform_reverse_map() for mapping short platform tags back to full platform strings.

Create narrow //ci/ray_ci:supported_images Bazel target visible to //release:subpackages. Re-import format_platform_tag in image_tags_lib.py. Update tests for ValueError (was ImageTagsError). Remove duplicate test classes from test_push_release_test_image.py.

Topic: shared-lib
Relative: rayci-39
Labels: draft
Signed-off-by: andrew andrew@anyscale.com

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

andrew-anyscale commented Mar 30, 2026

Reviews in this chain:
#62263 [CI] bump rayciversion to 0.39.0
 └#62200 [CI] Add format_platform_tag and build_platform_reverse_map to supported_images
  └#62201 [CI] Convert _images.rayci.yml from matrix to array syntax
   └#62202 [CI] Convert _wheel-build.rayci.yml from matrix to array syntax
    └#62207 [CI] Switch anyscale CUDA wandas from cu$CUDA_VERSION to $PLATFORM
     └#62203 [CI] Convert release/build.rayci.yml to array + update get_prerequisite_step

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

andrew-anyscale commented Mar 30, 2026

# head base diff date summary
0 108695b5 7eb1006e diff Mar 30 10:09 AM 7 files changed, 116 insertions(+), 60 deletions(-)
1 d5e92ccb 7eb1006e diff Mar 30 10:46 AM 1 file changed, 7 insertions(+), 1 deletion(-)
2 3fced168 9f0061c4 diff Apr 1 8:20 AM 0 files changed

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 refactors platform tag formatting by moving format_platform_tag to a centralized supported_images module and introduces build_platform_reverse_map to map short tags back to full platform strings. Corresponding tests were updated or moved to reflect these changes. Feedback was provided to handle potential ambiguities in the reverse map generation by raising an error if multiple full platform strings resolve to the same short tag, ensuring deterministic behavior.

Comment on lines +86 to +87
if short not in reverse_map:
reverse_map[short] = platform
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.

high

The current implementation for building the reverse map might lead to silent and non-deterministic behavior if ray-images.json ever contains different full platform strings that shorten to the same tag (e.g., cu12.1.1 and cu12.1.2 would both become cu121). The if short not in reverse_map: logic means the first one encountered wins, and which one is first can be arbitrary as it depends on dict iteration order which is not guaranteed to be stable from json.loads.

To make this more robust, I suggest raising an error if an ambiguous mapping is detected. This will prevent subtle bugs in the future.

Suggested change
if short not in reverse_map:
reverse_map[short] = platform
if short in reverse_map:
if reverse_map[short] != platform:
raise ValueError(
f"Ambiguous short platform tag '{short}': "
f"could be '{platform}' or '{reverse_map[short]}'"
)
else:
reverse_map[short] = platform

…ted_images

Move format_platform_tag() from image_tags_lib.py to supported_images.py (zero external deps) and add build_platform_reverse_map() for mapping short platform tags back to full platform strings.

Create narrow //ci/ray_ci:supported_images Bazel target visible to //release:__subpackages__. Re-import format_platform_tag in image_tags_lib.py. Update tests for ValueError (was ImageTagsError). Remove duplicate test classes from test_push_release_test_image.py.

Topic: shared-lib
Relative: rayci-39
Labels: draft
Signed-off-by: andrew <andrew@anyscale.com>
…_map

If two different full platform strings shorten to the same tag (e.g., cu12.1.1 and cu12.1.2 both → cu121), raise ValueError instead of silently using whichever appeared first.

Topic: shared-lib
Relative: rayci-39
Labels: draft
Signed-off-by: andrew <andrew@anyscale.com>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/shared-lib branch from d5e92cc to 3fced16 Compare April 1, 2026 15:20
@andrew-anyscale andrew-anyscale changed the base branch from andrew/revup/master/rayciversion-upgrade to andrew/revup/master/rayci-39 April 1, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant