I'm passing a dagger Directory object in to a Function. Is it possible to get the string path to the directory on the host once in the container, for the purposes of passing this to an export call? I could pass a string parameter instead, but a Directory seems more appropriate, or is there a different parameter I should use in the Function?
#Get string path to dagger Directory in Function parameter
1 messages · Page 1 of 1 (latest)
Hey! The Directory path is not exposed in the API but you can't rely on it as Directory objects can come through different sources and transformations. Even if you did have that, it won't work the way you're trying to if I understand you correctly.
When you call export in a Function, the artifact will be exported to the container that runs your module (see Execution Environment in the docs). It won't export it to your host machine. For that you need to export from the CLI (see Artifact Export in the docs).
Basically, have your Function return Directory, and add export --path=<destination> to your dagger call. See an example in our dev module.
Basically, have your Function return
Directory, and addexport --path=<destination>to yourdagger call. See an example in our dev module.
This is kind of what I expected the answer to be.
My only criticism with this design constraint is I don’t really want long commands to have to remember for the build process, even if they’re in a readme to copy and paste.
This leads me to want to abstract that complexity with a Function or put it in a script or make file, which then takes us back to why I want to move to dagger in the first place.
We're aware of this. See https://github.com/dagger/dagger/issues/6723
There's more issues related to that one, with other proposals/suggestions. We do plan on making dagger call simpler to use but haven't been able to focus enough time on it yet due to other priorities.
If you have ideas, feel free to contribute your thoughts. Here's a few more related issues: