#Context directory (defaultPath) when calling a dependent/remote module

1 messages · Page 1 of 1 (latest)

scenic oyster
#

If I set defaultPath="/" on SomeFunction(source *dagger.Directory) in a module and then call it remotely as dagger call -m {url-to-my-module} some-function, source will default to the git-root of the module's repository instead of mine. Is this intended, or am I missing something here? Wasn't the point of context directory to let modules/functions more easily access the repository context?

Even if I dagger install the module and call it either from the repo-local dagger module or with call -m, I have to explicitly pass --source . for it to have the context that's useful to me.
Am I missing something?

scenic oyster
#

Context directory (defaultPath) when calling a dependent/remote module

lean crane
#

Wasn't the point of context directory to let modules/functions more easily access the repository context?

Yes, but it's the repo where the module is, by design.

The use case is a module that daggerizes an existing project. Meaning it's located next to it. So when called from a remote, it's expected that the module would want to access the files it's daggerizing, in the same repo.

If it's a reusable function, not tied to a particular project, then that's not a proper use for defaultPath and the directory should be provided explicitly.

scenic oyster
#

Alright, thanks 🙂

uneven trail
#

@scenic oyster this was a difficult design decision because we do want to support the pattern you describe ("toolchain modules") but we didn't find a way to fit it in, so had to cut it for now.

If you're interested in the design context: #1274024997601542225 message

scenic oyster
#

Thanks for the context. My use-case is mostly building an opinionated internal CI/build toolkit, where so far it looks like plenty of the functions I'm making can be easily relevant without integrating them into another dagger module. The --source . UX hit is not that bad if you hold onto the source in a custom type throughout a couple chained calls.