Skip to content

[ci] Fix crane auth issue for nightly multi arch tagging#53483

Merged
aslonnie merged 14 commits intomasterfrom
khluu/fix_crane
Jun 10, 2025
Merged

[ci] Fix crane auth issue for nightly multi arch tagging#53483
aslonnie merged 14 commits intomasterfrom
khluu/fix_crane

Conversation

@khluu
Copy link
Copy Markdown
Contributor

@khluu khluu commented Jun 2, 2025

  • Add prefix rayproject/ray for all tags
  • Authorize docker with credentials from SSM
  • Mock authorize docker in unit test since it's not needed

khluu added 2 commits June 2, 2025 18:16
p
Signed-off-by: kevin <kevin@anyscale.com>
p
Signed-off-by: kevin <kevin@anyscale.com>
@khluu khluu added the go add ONLY when ready to merge, run all tests label Jun 2, 2025
khluu added 4 commits June 2, 2025 18:38
p
Signed-off-by: kevin <kevin@anyscale.com>
p
Signed-off-by: kevin <kevin@anyscale.com>
p
Signed-off-by: kevin <kevin@anyscale.com>
@khluu khluu changed the title Fix crane auth issue [ci] Fix crane auth issue for nightly multi arch tagging Jun 5, 2025
p
Signed-off-by: kevin <kevin@anyscale.com>
@khluu khluu marked this pull request as ready for review June 5, 2025 07:17
Copilot AI review requested due to automatic review settings June 5, 2025 07:17
@khluu khluu requested a review from a team as a code owner June 5, 2025 07:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures multi-architecture nightly images are tagged and indexed correctly by:

  • Prefixing all image tags with the rayproject/ray repository.
  • Adding Docker Hub authorization via AWS SSM for raytravisbot.
  • Mocking authorize_docker in the unit test to avoid real login.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ci/ray_ci/automation/generate_index.py Prefix tags with rayproject/ray: before indexing.
ci/ray_ci/automation/docker_tags_lib.py Add authorize_docker (SSM fetch + docker login).
ci/ray_ci/automation/test_docker_tags_lib.py Mock authorize_docker in test_generate_index.
.buildkite/build.rayci.yml Remove skip-on-premerge tag from nightly step.
Comments suppressed due to low confidence (3)

ci/ray_ci/automation/docker_tags_lib.py:662

  • Add a docstring explaining what _get_ssm does, its parameters, and return value for clarity.
def _get_ssm(token_name):

ci/ray_ci/automation/test_docker_tags_lib.py:693

  • After mocking authorize_docker, add an assertion such as mock_authorize_docker.assert_called_once() in test_generate_index to verify the login step is invoked.
@mock.patch("ci.ray_ci.automation.docker_tags_lib.authorize_docker")

ci/ray_ci/automation/generate_index.py:18

  • Prefixing tags before your suffix-based matching logic may break the -aarch64 checks (they currently expect raw tags). Consider splitting on : or applying the rayproject/ray: prefix only when pushing, not during index selection.
tags = [f"rayproject/ray:{tag}" for tag in tags]



def generate_index(index_name: str, tags: List[str]) -> bool:
print(f"Generating index {index_name} with tags {tags}")
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Replace print with the shared logger (e.g. logger.info) to keep logging consistent across this module.

Suggested change
print(f"Generating index {index_name} with tags {tags}")
logger.info(f"Generating index {index_name} with tags {tags}")

Copilot uses AI. Check for mistakes.


def _get_ssm(token_name):
client = boto3.client("ssm", region_name="us-west-2")
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Avoid hard-coding the AWS region. Consider reading region_name from configuration or an environment variable to improve flexibility.

Suggested change
client = boto3.client("ssm", region_name="us-west-2")
aws_region = os.environ.get("AWS_REGION", "us-west-2")
client = boto3.client("ssm", region_name=aws_region)

Copilot uses AI. Check for mistakes.
@khluu
Copy link
Copy Markdown
Contributor Author

khluu commented Jun 5, 2025

indexes got pushed to dockerhub here: https://hub.docker.com/r/rayproject/ray/tags?name=nightly

Signed-off-by: kevin <kevin@anyscale.com>
@khluu khluu requested a review from aslonnie June 5, 2025 08:42
p
Signed-off-by: kevin <kevin@anyscale.com>
import requests
import runfiles

import boto3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: could you add back a blank line? and maybe also sort the 3rd-party imports?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done


bazel_workspace_dir = os.environ.get("BUILD_WORKSPACE_DIRECTORY", "")
SHA_LENGTH = 6
DOCKERHUB_SSM_NAME = "docker_hub_password"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove this now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

tags:
- docker
- oss
- skip-on-premerge
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this needs to be restored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done



def test_generate_index():
@mock.patch("ci.ray_ci.automation.docker_tags_lib.authorize_docker")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove these now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

tags = list_image_tags(
prefix, RayType.RAY, PYTHON_VERSIONS_RAY, PLATFORMS_RAY, ARCHITECTURES_RAY
)
tags = [f"rayproject/ray:{tag}" for tag in tags]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

move these down, and call them refs or images ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wdym by moving these down?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm.. I do not know what I was talking about..

It think I meant that you would want to add it after tags are being paired.

I also mentioned that to stop using not in and in for suffix checking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated the logic by using endswith instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and I don't think adding rayproject/ray before or after tags are paired should change anything?

khluu added 2 commits June 9, 2025 18:53
p
Signed-off-by: kevin <kevin@anyscale.com>
@khluu
Copy link
Copy Markdown
Contributor Author

khluu commented Jun 9, 2025

Test pass https://buildkite.com/ray-project/postmerge/builds/10708#0197560c-8819-429f-832a-213028dba23e
and indexes are pushed to dockerhub
image

khluu added 2 commits June 9, 2025 22:04
p
Signed-off-by: kevin <kevin@anyscale.com>
Signed-off-by: kevin <kevin@anyscale.com>
@khluu khluu requested a review from aslonnie June 9, 2025 22:44
p
Signed-off-by: kevin <kevin@anyscale.com>
@aslonnie aslonnie self-requested a review June 10, 2025 09:41
@aslonnie aslonnie merged commit d90e270 into master Jun 10, 2025
5 checks passed
@aslonnie aslonnie deleted the khluu/fix_crane branch June 10, 2025 16:32
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
- Add prefix `rayproject/ray` for all tags
- Authorize docker with credentials from SSM
- Mock authorize docker in unit test since it's not needed

---------

Signed-off-by: kevin <kevin@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
- Add prefix `rayproject/ray` for all tags
- Authorize docker with credentials from SSM
- Mock authorize docker in unit test since it's not needed

---------

Signed-off-by: kevin <kevin@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants