Repository navigation
Remove Host API from module SDK codegen. - #6535
Conversation
|
I only ran a subset of tests locally, but didn't run Been thinking through whether there's any reasonable options here that also maintains the current approach, but don't see any; only see options that would hack dagql in unreasonable ways. I am going to give a shot at a different approach that still allows the host schema to be loaded for module clients on the graphql level, but just not presented to SDKs for codegen. Should create same end effect while still allowing use cases like this to work. |
|
The new approach described in previous comment works much better and thankfully isn't quite as kludgy as I originally imagined: 685e6e5 I could actually see it being useful in general outside this use case; e.g. I considered doing the same thing to block the |
|
If we're removing the host api entirely, it's now not possible to tunnel/reverse-tunnel a service from the module container? I quite liked this feature, and I'm not sure if we should remove it - though maybe it does genuinely belong somewhere else (e.g. under |
gives more controlled functionality that is specific to modules. We do need to leave in the underlying graphql schema for host because it's needed for internal calls (e.g. a host service passed to a module function). So this just results in the Host types being scrubbed from the introspection JSON that is provided to module SDKs for codegen. Signed-off-by: Erik Sipsma <[email protected]>
This library seems to be very opinionated about the exact format of the introspection json, so need to add a few `omitempty`s and add a (currently always empty) `interfaces` to `Type`. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
|
(rebased to fix merge conflicts against main) |
Signed-off-by: Justin Chadwell <[email protected]>
|
Removed the changelog entry, following the same logic as in #6546 |
There was a problem hiding this comment.
Happy to take this now, since it'll be good to remove the access to the host files for this release.
But also, I want to make sure that #6535 (comment) doesn't get lost, and that we have a way to restore this in the future.
(ahhh, I've realized we can do tunnels using the chainable up to do this)
🔥 Update Instructions for Breaking Changes
Modules that use the Host API to read source files
(using go syntax below, but same idea applies to all SDKs)
Previously, module containers set their working directory to the directory containing the module's source code. You could then read files from that directory with calls like
dag.Host().File("./some/file.txt").Now, module containers are set to an initially empty scratch directory, so those calls will not work anymore.
To use files/directories from the module source code, you can instead:
dag.CurrentModule().Source().Directory("some/subdir")dag.CurrentModule().Source().File("some/file.txt")Additionally, it used to technically be possible to use files/directories from anywhere in the root dir loaded for a module in the case where
"root"was configured indagger.json. This is no longer possible; instead anything you need to use from outside the module's source code directory should be accepted as an argument to a function or the module constructor.One final use case to mention: if you need to create new files/directories and then load them into the dagger API during module execution, this is still possible.
dag.CurrentModule().Workdir("./some/dir")dag.CurrentModule().WorkdirFile("./some/file.txt")The new dag.CurrentModule() API replaces the need for the Host API and gives more controlled functionality that is specific to modules.
Fixes #6312
More details on the new API in this PR description (specifically
CurrentModule API).TODO: