You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: allow passing sub-directories of a git repo #6944
When passing an argument of type Directory, the CLI accepts a git remote url (eg. https://github.com/dagger/dagger) which is awesome; but it does not support passing a sub-directory of that git repo (eg. https://github.com/dagger/dagger/docs) which is not awesome.
Solution
Support passing a sub-directory of a git remote as CLI argument to Dagger CLI.
Supporting generic slashes is interesting, but I'm not actually sure how possible this is given how nesting works:
github.com/foo/bar/baz/qux is an org foo with project bar with baz/qux as the path
gitlab.com/foo/bar/baz/qux could be:
an org foo with project bar with baz/qux as the path
an org foo with sub-org bar with project baz with qux as the path
an org foo with sub-org bar with sub-org baz with project qux
We've discussed this before in relation to module refs - cc @vito. We could just steal what go does today, and use special meta tags in pages (maybe it's worth just biting that bullet?)
Supporting generic slashes is interesting, but I'm not actually sure how possible this is given how nesting works:
github.com/foo/bar/baz/qux is an org foo with project bar with baz/qux as the path
gitlab.com/foo/bar/baz/qux could be:
an org foo with project bar with baz/qux as the path
an org foo with sub-org bar with project baz with qux as the path
an org foo with sub-org bar with sub-org baz with project qux
We've discussed this before in relation to module refs - cc @vito. We could just steal what go does today, and use special meta tags in pages (maybe it's worth just biting that bullet?)
Don't we have to solve this problem anyway for dagger -m <MOD>?
I do think it's a little weird for users, that we have 2 completely different ways to describe the same thing (a directory inside a remote git repo) depending on which flag it's being passed to.
@shykes Yep, that's what the v2 refs proposal was all about (#6187); it was meant to be a unified ref syntax for any Directory, which could be used for both module refs and arbitrary git + subpath refs. But then we got stuck in discussions around whether we want short refs for the Daggerverse and the proposal died.
Combined with #6895 where a contributor is trying to decouple our module refs from GitHub, it feels like it's time to revive that proposal (in spirit, not necessarily in its last form).
Potential proposal - could we "borrow" the go method of working out where the split is, and then also add our own version in as well (essentially s/go/dagger) for anyone implementing it from scratch?
That would help at least unblock #6895, even if we don't fully get to the full power of refs v2 described in #6187. Personally, I don't love the git syntax we pull from buildkit, I'd happily deprecate it and replace it with go-style refs - it's incredibly non obvious how to use it, I always forget the order of the fragment.
Activity
jedevc commentedon Mar 27, 2024
This can be done today using something like the following syntax:
This is the same syntax as found in dockerfiles - see https://docs.docker.com/build/building/context/#url-fragments.
Supporting generic slashes is interesting, but I'm not actually sure how possible this is given how nesting works:
github.com/foo/bar/baz/quxis an orgfoowith projectbarwithbaz/quxas the pathgitlab.com/foo/bar/baz/quxcould be:foowith projectbarwithbaz/quxas the pathfoowith sub-orgbarwith projectbazwithquxas the pathfoowith sub-orgbarwith sub-orgbazwith projectquxWe've discussed this before in relation to module refs - cc @vito. We could just steal what go does today, and use special
metatags in pages (maybe it's worth just biting that bullet?)shykes commentedon Mar 27, 2024
This works fine for me. We should just document it.
shykes commentedon Mar 27, 2024
Don't we have to solve this problem anyway for
dagger -m <MOD>?I do think it's a little weird for users, that we have 2 completely different ways to describe the same thing (a directory inside a remote git repo) depending on which flag it's being passed to.
vito commentedon Mar 27, 2024
@shykes Yep, that's what the v2 refs proposal was all about (#6187); it was meant to be a unified ref syntax for any
Directory, which could be used for both module refs and arbitrary git + subpath refs. But then we got stuck in discussions around whether we want short refs for the Daggerverse and the proposal died.Combined with #6895 where a contributor is trying to decouple our module refs from GitHub, it feels like it's time to revive that proposal (in spirit, not necessarily in its last form).
jedevc commentedon Mar 28, 2024
Potential proposal - could we "borrow" the go method of working out where the split is, and then also add our own version in as well (essentially
s/go/dagger) for anyone implementing it from scratch?That would help at least unblock #6895, even if we don't fully get to the full power of refs v2 described in #6187. Personally, I don't love the git syntax we pull from buildkit, I'd happily deprecate it and replace it with go-style refs - it's incredibly non obvious how to use it, I always forget the order of the fragment.
pjmagee commentedon May 25, 2024
How does terraform do it?
helderco commentedon Jul 5, 2024
@grouville, can you own this as well?
link: dagger#6957 and dagger#6944
link: dagger#6957 and dagger#6944