forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support post build script for byod (ray-project#36457)
Signed-off-by: can <can@anyscale.com> Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
- Loading branch information
1 parent
a89092b
commit 2a77981
Showing
12 changed files
with
185 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# syntax=docker/dockerfile:1.3-labs | ||
# shellcheck disable=SC2148 | ||
|
||
ARG BASE_IMAGE | ||
FROM "$BASE_IMAGE" | ||
|
||
ARG POST_BUILD_SCRIPT | ||
|
||
COPY "$POST_BUILD_SCRIPT" /tmp/post_build_script.sh | ||
RUN /tmp/post_build_script.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# This script is used to build an extra layer on top of the base anyscale/ray image | ||
# to run the agent stress test. | ||
|
||
set -exo pipefail | ||
|
||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | ||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sys | ||
|
||
import pytest | ||
from unittest.mock import patch | ||
from typing import List | ||
|
||
from ray_release.test import Test | ||
from ray_release.byod.build import build_anyscale_custom_byod_image | ||
|
||
|
||
def test_build_anyscale_custom_byod_image() -> None: | ||
cmds = [] | ||
|
||
def _mock_check_call( | ||
cmd: List[str], | ||
*args, | ||
**kwargs, | ||
) -> None: | ||
cmds.append(cmd) | ||
|
||
with patch( | ||
"ray_release.byod.build._byod_image_exist", return_value=False | ||
), patch.dict( | ||
"os.environ", | ||
{"BUILDKITE_COMMIT": "abc123", "BUILDKITE_BRANCH": "master"}, | ||
), patch( | ||
"subprocess.check_call", | ||
side_effect=_mock_check_call, | ||
): | ||
test = Test( | ||
name="name", | ||
cluster={"byod": {"post_build_script": "foo.sh"}}, | ||
) | ||
build_anyscale_custom_byod_image(test) | ||
assert "docker build --build-arg BASE_IMAGE=029272617770.dkr.ecr.us-west-2." | ||
"amazonaws.com/anyscale/ray:abc123-py37 -t 029272617770.dkr.ecr.us-west-2." | ||
"amazonaws.com/anyscale/ray:abc123-py37-c3fc5fc6d84cea4d7ab885c6cdc966542e" | ||
"f59e4c679b8c970f2f77b956bfd8fb" in " ".join(cmds[0]) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(pytest.main(["-v", __file__])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters