#how to create func Build with no arguments but always uses current directory
1 messages ยท Page 1 of 1 (latest)
impossible to find in our current docs structure but here you go: https://docs.dagger.io/api/arguments#directories-and-files
ohh it looks quite complicated with the pragmas... i would like to avoid arguments at all. before there was smth like client.Host().Directory("."), but now it does not work... or am i doing smth wrong?
Making them arguments allows dagger to statistically analyze the inputs of your function and optimize its caching. It also allows your caller to override the argument if needed, making your function more reusable.
thanks, i will try the recommended approach
Once you get the hang of it it's quite pleasant ๐
thank you! it worked ๐
What is the issue? People want to do this, but can't find it. Prob means moving the page up in the hierarchy, making sure search works well, including into quickstart, etc. https://docs.dagger....
Love to know if you tried to search for this in the docs and what search terms you used ๐ feel free to add to the new issue above too ๐
hello! i tried to find smth in the cookbook, with no success. then i walked through the quickstart, no luck. then i tried finding some clue in the dagger api, sdks section, no luck. i asked chatgpt, it recommended using "client.Host().Directory(".")`, it did not work. all the keywords i had in mind were "host" and "directory" so i used the search term "host directory" and could not find anything as well.
cc @frozen cipher ๐
Yes, on my list to make this easier to find asap
... And also easier to grok
Raising the priority, will have a proposed fix by tomorrow
thx Vikram, apologies for the direct ping. Just wanted to put it in your radar in case you missed it ๐
It would be great to have your feedback on my proposed changes for this issue plus any other ideas @plucky stirrup @serene sparrow @gaunt summit: https://github.com/dagger/dagger/issues/9493#issuecomment-2639808627
hey, another question. that defaultPath pragma does not support git urls like "https://github.com/user/repo" ?
My understanding is that remote URLs are not supported. It's just for paths in the local context, relative to the dagger.json. Maybe @plucky stirrup has more info though
@tawdry basalt IIRC using default in a dagger.Directory type should allow you to use URL's
defaultPath is only to interact with the host filesystem
thank you, i will try using default
wait really? I had no idea
you're correct Solomon, I was got confused by looking at the code with the directory argument flag parsing instead of the pragmas. So yes, @tawdry basalt sorry for the confusion, there's currently no way of providing a default repo as a directory argument ๐ฌ
but would be a great addition! And shouldn't be too hard I think
yes, i tried before seeing the chat and got very very sad ๐ฅน
would be a really nice addition, probably named defaultURL or similar, but default is also ok
Yeah.. default should work. I'll be on PTO next week but I can get this one when I get back if nobody has taken it
i actually do not see any point in having defaultPath then, because i guess there will be some regexp matching for the default, which can be extended for supporting file system paths as well