Skip to content

Commit

Permalink
Create an environment variable to specify BYOD image tag for running …
Browse files Browse the repository at this point in the history
…release tests

Currently release test infra generate the BYOD image tag for a test automatically. This PR gives folks a way to curate the tag by themselves.

Signed-off-by: can <[email protected]>
Signed-off-by: harborn <[email protected]>
  • Loading branch information
can-anyscale authored and harborn committed Aug 17, 2023
1 parent 51d9cb0 commit 3266506
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
12 changes: 8 additions & 4 deletions release/ray_release/byod/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ def _validate_and_push(byod_image: str) -> None:
.decode("utf-8")
.strip()
)
expected_ray_commit = _get_ray_commit()
assert (
docker_ray_commit == expected_ray_commit
), f"Expected ray commit {expected_ray_commit}, found {docker_ray_commit}"
if os.environ.get("RAY_IMAGE_TAG"):
logger.info(f"Ray commit from image: {docker_ray_commit}")
else:
expected_ray_commit = _get_ray_commit()
assert (
docker_ray_commit == expected_ray_commit
), f"Expected ray commit {expected_ray_commit}, found {docker_ray_commit}"
logger.info(f"Pushing image to ECR: {byod_image}")
subprocess.check_call(
["docker", "push", byod_image],
stdout=sys.stderr,
Expand Down
6 changes: 6 additions & 0 deletions release/ray_release/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ def get_byod_base_image_tag(self) -> str:
"""
Returns the byod image tag to use for this test.
"""
byod_image_tag = os.environ.get("RAY_IMAGE_TAG")
if byod_image_tag:
# Use the image tag specified in the environment variable.
# TODO(can): this is a temporary backdoor that should be removed
# once civ2 is fully rolled out.
return byod_image_tag
commit = os.environ.get(
"COMMIT_TO_TEST",
os.environ["BUILDKITE_COMMIT"],
Expand Down
5 changes: 5 additions & 0 deletions release/ray_release/tests/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def test_get_ray_image():
_stub_test({"cluster": {"byod": {}}}).get_ray_image()
== "rayproject/ray:pr-123.123456-py38-cpu"
)
with mock.patch.dict(os.environ, {"RAY_IMAGE_TAG": "my_tag"}):
assert (
_stub_test({"cluster": {"byod": {}}}).get_ray_image()
== "rayproject/ray:my_tag"
)


def test_get_anyscale_byod_image():
Expand Down

0 comments on commit 3266506

Please sign in to comment.