Repository navigation
explicitly pass workspace to currentModule.asSDK - #11
Merged
Merged
Conversation
dagger/dagger#13727 added an optional `workspace` argument to `currentModule.asSDK`, so the SDK-role data resolves against an explicitly passed workspace instead of the ambient current workspace — which dependency modules cannot see since workspace inheritance was disabled. Use it instead of the `ws.sdk(name: currentModule.name)` workaround: looking the SDK up by module entry name only worked by coincidence of the entry being named after the module, and it read the workspace's SDK list rather than the current module's own as-sdk role. Signed-off-by: Tom Chauveau <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of dagger/go-sdk#14, pairing with dagger/dagger#13727.
currentModule.asSDKnow takes an optionalworkspaceargument, so an SDK module driven as a dependency can resolve its as-sdk role against the workspace it was handed instead of an ambient current workspace it cannot see.modules()was working around the missing argument withws.sdk(name: currentModule.name), which resolved the workspace's SDK list by module entry name — correct only because the entry happens to be named after the module. It now readscurrentModule.asSDK(workspace: ws).modules, matching the Go SDK.Differences from the Go SDK PR
modulesCwdChecksnapshots the workspace through anincludefilter and had to adddagger.tomlso the re-anchored workspace still carries the[[modules.<sdk>.as-sdk.modules]]list. The Python SDK'smoduleDiscoveryCheckre-anchors with an unfilteredws.directory("/"), so the workspace config is already present.mod()has nomanagedBasehelper to thread a workspace through — the Python SDK resolves module lookup from config files only, so the Go SDK's second call site has no counterpart here.Test
dagger --x-release=main check— 11/11 passing.