-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call Dagger Functions from an external client #5993
Comments
Today its pretty clear how to use dagger modules from other modules, but its not obvious to me how to use dagger modules from "original dagger" code, I was experimenting with things yesterday and ran into some strange behavior that I cant fully describe. One question that came out of this for me was what happens to Ultimately, do we imagine there being a clear integration or onramp from current dagger to modules, or does this assume people rewrite everything as a module. |
@levlaz Our current running assumption is that while the existing dagger use case of running SDK code directly on the host will continue to exist and be supported, it will become an "advanced use case" and not be the primary focus of attention. We'll encourage every one to write modules (and to convert existing code over to modules). However, in our current plans there still would be occasional genuine use cases for non-module code so it does make sense to at least support calling module code from non-module code. I'm mainly onboard with that because it's fairly straightforward afaict. Internally, the codegen that runs that allows you to call other modules from your module code is almost entirely the same codegen that we use to allow non-module code to call the core API today. So it just needs some slight adjustments to support the use case described in this issue.
If it wasn't the case that this was fairly easy (or if we hit some unexpected bumps once we get to actually trying to implement this), then I'd start to question more whether we even should do it. But right now it's in a state of just easy-enough and potentially useful-enough that I feel we may as well.
This specific subtopic will be decided on as part of this issue for simplifying the current CLI command set: #6229 |
To add my thoughts on this, I would like to see support to call / use modules from standard dagger code. I have a test suite that will either allow developers to connect to a local database when working locally, or a dagger based service when in the CI/CD pipeline. At least while we migrate all users over to use dagger modules locally! To expand on our setup, we use the The aim is to have fairly generic test code (maybe a module in the future) with all customisation left to the individual module developers. Happy to continue the conversation here or on discord |
Going to pick this one up in the near future. Have some new thoughts on how to approach:
|
If I read this correctly, the go side for point 1 would be: import myMod "github.com/foo/bar/my-mod"
func test() {
myMod.functionCall(args)
} If so, at least for golang, that would be great. I'd personally prefer that then having to exec out to a sub processes |
I'm very interested in this. My use case is to put Dagger functions inside Temporal Activities. I was hoping it would be a generally easy coding task and thought it not being easy was because of my lack of experience with Go and more in particular working with different contexts. I guess it isn't so easy. 🤔 I believe I can get around this by using Scott |
You can do it with a GraphQL query, you just won't have the client bindings in |
Right now if you want to call functions available in a module, the only reasonable ways are from another module or from the CLI.
Otherwise you are on your own to load the module and construct graphql queries for it.
We can add support for codegening clients that include module deps but are intended to run on a host rather than as part of another module.
The implementation would just involve a hybrid of the existing "standard client codegen" and the module codegen, is most likely fairly straightforward other than deciding on how to expose it in terms of ux/dx.
The text was updated successfully, but these errors were encountered: