feat(wanda): add Artifact struct to spec for extraction#407
feat(wanda): add Artifact struct to spec for extraction#407andrew-anyscale wants to merge 1 commit intomainfrom
Conversation
|
Summary of ChangesHello @andrew-anyscale, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a robust mechanism for defining and extracting artifacts from container images built using the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the Artifact struct to the wanda spec, allowing users to define files and directories for extraction from built container images. The changes include the Artifact struct definition, its integration into the Spec struct, and the necessary logic for variable expansion. Corresponding tests have been added to validate parsing, variable expansion, and serialization of specs containing artifacts. My review focuses on improving documentation clarity and test correctness.
7699d79 to
70e0db3
Compare
313a1f8 to
7a60b1e
Compare
wanda/artifact.go
Outdated
| func (a *Artifact) CopyIntoDir(numSrcs int) bool { | ||
| return strings.HasSuffix(a.Dst, "/") || numSrcs > 1 | ||
| } |
There was a problem hiding this comment.
maybe ShouldCopyIntoDir? it is still unclear what this function means?
this does not seem to be used?
There was a problem hiding this comment.
It's used in the subsequent PR -- https://github.com/ray-project/rayci/pull/411/changes#diff-c7fe292f56579652957100e992ec51957cb167f5787d0ac59d1171f7cf872a32R262
It can be a little challenging to split these PRs out to smaller review chunks, while still preserving general structure. I'll try to move this fn out to the next PR
There was a problem hiding this comment.
| } | ||
|
|
||
| // matchFiles returns files that match the artifact's glob pattern. | ||
| func (a *Artifact) matchFiles(files []string) []string { |
There was a problem hiding this comment.
are we like listing all the files first and then perform the matching? should we send in a fs interface or something? this can be a lot of files to match (potentially files of the whole container, which can be a lot?)
There was a problem hiding this comment.
https://github.com/ray-project/rayci/pull/411/changes#diff-c7fe292f56579652957100e992ec51957cb167f5787d0ac59d1171f7cf872a32R233
^ This is the implementation detail. If we have no globs, we can call docker cp directly and avoid any filesystem parsing, which is the optimal case.
If we do have a glob, then we have to export the filesystem to get all filenames. https://github.com/ray-project/rayci/pull/411/changes#diff-7df0dd7dbd85029bba68703b7de4462bee6f7f6fe89a15f9286c6d09d1897323R160
Running on the wheel image today to extract the wheel glob, it takes <1s
# ci/docker/ray-wheel.wanda.yaml
artifacts:
- src: "/*.whl"
dst: ./
$ PYTHON_VERSION=3.13 MANYLINUX_VERSION=260128.221a193 HOSTTYPE=aarch64 ARCH_SUFFIX=-aarch64 BUILDKITE_COMMIT=b5737cefc0 IS_LOCAL_BUILD=true /Users/andrew/devel/rayci-wanda-artifacts/_release/wanda-darwin-arm64 --artifacts_dir .whl/ ci/docker/ray-wheel.wanda.yaml
2026/02/04 09:10:39 extracting 1 artifact(s) from localhost:5000/rayci-work:ray-wheel-py3.13-aarch64
Successfully copied 72MB to /Users/andrew/devel/ray-local-wheel-build/.whl/ray-3.0.0.dev0-cp313-cp313-manylinux2014_aarch64.whl
2026/02/04 09:10:40 extracted 1 artifact(s) in 722ms:
2026/02/04 09:10:40 /Users/andrew/devel/ray-local-wheel-build/.whl/ray-3.0.0.dev0-cp313-cp313-manylinux2014_aarch64.whl
| // Artifact defines a file or directory to extract from a built image. | ||
| type Artifact struct { | ||
| // Src is the path inside the container to extract. | ||
| // Can be a file, directory, or glob pattern (e.g., "/*.whl"). |
There was a problem hiding this comment.
do we really need glob pattern support? glob only matches file name, right?
There was a problem hiding this comment.
I went back-and-forth on glob inclusion, and settled on it being worth inclusion. It drastically simplifies the Wheel upload case. Without this, we'd need to rename the wheel file away from schemas like ray-3.0.0.dev0-cp310-cp310-manylinux2014_x86_64.whl and into a generic name.
Yes, glob only matches file names currently.
Define Artifact struct for specifying files to extract from built images: - src: absolute path inside container (supports glob patterns like "/*.whl") - dst: relative path in artifacts directory - optional: if true, missing files warn instead of fail Includes helper methods for path resolution and validation: - Validate(): ensures src is absolute, dst is relative, no path traversal - ResolveSrcs(): resolves glob patterns against container file list - ResolveDst(): resolves destination within artifacts directory - CopyIntoDir(): determines if copying into directory vs renaming Topic: wanda-artifact-spec Signed-off-by: andrew <andrew@anyscale.com>
7a60b1e to
928b35c
Compare
Define Artifact struct for specifying files to extract from built images:
Includes helper methods for path resolution and validation:
Topic: wanda-artifact-spec
Signed-off-by: andrew andrew@anyscale.com