Skip to content

[wanda] Add context_owner spec option and include in cache digest#481

Merged
andrew-anyscale merged 1 commit intomainfrom
andrew/revup/main/add-context-owner-spec
Apr 6, 2026
Merged

[wanda] Add context_owner spec option and include in cache digest#481
andrew-anyscale merged 1 commit intomainfrom
andrew/revup/main/add-context-owner-spec

Conversation

@andrew-anyscale
Copy link
Copy Markdown
Contributor

@andrew-anyscale andrew-anyscale commented Apr 2, 2026

Add context_owner field to the wanda Spec, allowing .wanda.yaml files to specify a "uid:gid" override for all files in the build context tar. Wire it through resolveBuildInput to set the tarStream owner, and include it in buildInputCore so changing context_owner invalidates the cache.

Topic: add-context-owner-spec
Relative: add-context-owner-tar

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Signed-off-by: andrew andrew@anyscale.com

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

andrew-anyscale commented Apr 2, 2026

Reviews in this chain:
#481 [wanda] Add context_owner spec option and include in cache digest

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

andrew-anyscale commented Apr 2, 2026

# head base diff date summary
0 c04891d6 fac3b483 diff Apr 2 13:44 PM 3 files changed, 16 insertions(+)
1 c438d68c 91254ad6 diff Apr 2 13:55 PM 2 files changed, 5 insertions(+), 1 deletion(-)
2 917c48ad 08d056c8 diff Apr 2 19:35 PM 0 files changed
3 0f7f787b 94f6a2f2 diff Apr 6 8:12 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 introduces a new ContextOwner field to the build specification, allowing users to override the UID and GID for files within the build context tar. The implementation correctly updates the spec structure, the build input core, and the forge logic to parse and apply these ownership settings. I have included a suggestion to ensure the ContextOwner field is processed through expandVar during specification expansion, which enables support for environment variable substitution and ensures proper cache invalidation.

Comment thread wanda/spec.go Outdated
result.BuildHintArgs = stringsExpandVar(s.BuildHintArgs, lookup)
result.DisableCaching = s.DisableCaching
result.Artifacts = artifactsExpandVar(s.Artifacts, lookup)
result.ContextOwner = s.ContextOwner
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.

medium

The ContextOwner field should be expanded using expandVar to allow the use of environment variables (e.g., context_owner: $UID:$GID) in the specification. Currently, it is copied as a literal string, which prevents variable substitution and will cause parseContextOwner to fail if variables are used. Additionally, it ensures the cache is correctly invalidated when these environment variables change.

Suggested change
result.ContextOwner = s.ContextOwner
result.ContextOwner = expandVar(s.ContextOwner, lookup)

@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/main/add-context-owner-spec branch from c04891d to c438d68 Compare April 2, 2026 20:55
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/main/add-context-owner-tar branch from fac3b48 to 91254ad Compare April 2, 2026 20:55
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/main/add-context-owner-spec branch from c438d68 to 917c48a Compare April 3, 2026 02:35
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/main/add-context-owner-tar branch from 91254ad to 08d056c Compare April 3, 2026 02:35
@andrew-anyscale andrew-anyscale marked this pull request as ready for review April 3, 2026 02:35
@andrew-anyscale andrew-anyscale requested a review from aslonnie April 3, 2026 02:35
Copy link
Copy Markdown
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

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

beautiful!

Base automatically changed from andrew/revup/main/add-context-owner-tar to main April 6, 2026 15:11
Add context_owner field to the wanda Spec, allowing .wanda.yaml files to specify a "uid:gid" override for all files in the build context tar. Wire it through resolveBuildInput to set the tarStream owner, and include it in buildInputCore so changing context_owner invalidates the cache.

Topic: add-context-owner-spec
Relative: add-context-owner-tar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: andrew <andrew@anyscale.com>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/main/add-context-owner-spec branch from 917c48a to 0f7f787 Compare April 6, 2026 15:12
@andrew-anyscale andrew-anyscale enabled auto-merge (squash) April 6, 2026 15:12
@andrew-anyscale andrew-anyscale merged commit 1823368 into main Apr 6, 2026
2 checks passed
@andrew-anyscale andrew-anyscale deleted the andrew/revup/main/add-context-owner-spec branch April 6, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants