Closed
Description
What are you trying to do?
Currently you can only dagger install modules hosted in public Git repositories. While this is great for OSS, it's not ideal for Enterprises that use private Git repositories like Gitlab and Github Enterprise.
We require a way to somehow pass in/use authentication (GH PAT for example) when adding a module hosted in a private git repository.
Discord thread: https://discord.com/channels/707636530424053791/1171809848057401375
Why is this important to you?
- Companies in highly regulated industries cannot publish modules in the open. Git repositories hosted within our Github Enterprise instance requires authentication in order to access. This is a blocker for using dagger modules.
- Personal projects that don't want to create public Git repositories aren't currently supported.
How are you currently working around this?
No known workaround so far which makes this a high priority request for us and any others using private Git repositories to host Dagger modules.
Reacted by David Reuss, Alvise, Charlie de Freitas, Siafu, Brian Dols, Chad Hanley, jornh, Manuel Leonhardt, Purple Clay, Sean Callahan and 35 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
skycaptain commentedon Mar 7, 2024
Bringing attention back to this issue now that modules have become the default. (I suppose, as the docs only mention the modules and previous cookbooks and guides have been removed). For us, this is the only obstacle preventing us from using Dagger modules at present. I think this could be a Good First Issue. However, general approval on support this would be highly appreciated before beginning implementation.
Alvise88 commentedon Mar 20, 2024
If i want to add a private lib in go.mod the problem arise the same
mehemken commentedon Apr 1, 2024
Just adding to the Why is this important to you? section.
I would like to keep my personal projects private.
No need to summon "highly regulated industry". It is just basic privacy.
Transmitt0r commentedon Apr 12, 2024
Would be a very nice feature, I'm interested in using this with modules hosted on our internal Bitbucket instance.
grouville commentedon Jun 3, 2024
This is under active development at this very moment
It is tightly linked to the implementation of #7218.
The first part is this PR: #7511, followed by another one for the directory refs, in which we unify the currently different way to reference directories and files on git remotes
This one has been unblocked recently by Erik's work on the CA certificates that allows passing SSH sockets securely. A draft PR shall be available this week, on which feedback from the community is welcome 😁
[-]✨ Zenith: Allow installing modules from private Git repositories.[/-][+]Allow installing modules from private Git repositories.[/+]oblogic7 commentedon Jul 3, 2024
Any updates or ETA for this functionality? I ran into this when doing a POC for my org.
LiHRaM commentedon Jul 4, 2024
@oblogic7
I followed the links posted by @grouville and found two PRs that haven't been merged
grouville commentedon Jul 4, 2024
Thanks @oblogic7 for asking, and @LiHRaM for the answer 🙏
A few intermediary steps were necessary too:
Indeed these are the two main PRs for the implementation: with #7708 to be the first one to be merged. #7608 will be a followup.
As stated in a comment with Nipuna, the current implementation relies on SSH auth, but the design also needs to anticipate the other forms of auth.
I've got a rebase / improvement for #7742 + a comment incoming, to discuss all the design choices implied to make sure with the community that every use case is taken into account and that the path to full implementation is clear and all intermediary implementations
grouville commentedon Aug 1, 2024
Update
Main PR for SSH support has been reviewed, and all the requested changes have been implemented. A bit more reviews are expected this week (yours is welcome too). This is probably going to be part of next release.
Your feedback is welcome, especially on the DX of this ref style, which you can see here
Once done, the http / https + PAT support is going to be my priority
skycaptain commentedon Aug 1, 2024
Great progress so far!
Regarding DX on the ref style:
gituser for SSH.[email protected]:dagger-modules/private/test/more/dagger-test-modules-private.git. It would be great if this format is also supported.grouville commentedon Aug 1, 2024
Oh sorry, the
gituser is inferred for that example. If this behavior creates confusion, I can add a comment OR change the logic to fail on that ?Current PR ref spec
[proto][user@]repo[.git][subpath][@version]With proto:
git+ssh://git+http://git+https://Empty proto is transformed as
git+https://For private repos, the [.git] is recommended to declaratively say where the repo separates and where the path inside the repo starts. Which is useful for private GitLab
cc @aluzzardi what do you think about SCP-like refs:
[email protected]:dagger-modules/private/test/more/dagger-test-modules-private.git. I know that @jedevc is against it, as it could become a rabbithole.Now, I do agree with you @skycaptain on the fact that these copy buttons are useful, but what I end up doing is copying the URL from the browser and edit it.
With above ref style, your:
[email protected]:dagger-modules/private/test/more/dagger-test-modules-private.gitwould become:
git+ssh://[email protected]/dagger-modules/private/test/more/dagger-test-modules-private.gitby adding the
protoand replacing the:.Would that be a no-go ?
skycaptain commentedon Aug 1, 2024
Ah, sorry, got it. You've just omitted the git user for that test. I think that might be fine for a test, even though it's very unlikely in the real world. If the user is not defined, one would rely on the devs to set up their
~/.ssh/configaccordingly. On the other hand, git has the same behaviour. So, not an issue, I guess. On a side note: Gitlab allows changing the default git user on self-hosted instances, even though it seems very rare for people to change that.Regarding the ref spec: You are right that both cases (using the Copy URL button or copying the URL from the browser's address bar) require manual editing the URL by the developer. Maybe it's just me, but when copying from the browser's address bar, I'm more prone to forgetting to add the
.gitsuffix (which seems kind of mandatory for dagger to detect subpaths) or copying a tree path likehttps://gitlab.com/dagger-modules/private/test/more/dagger-test-modules-private/-/tree/main/mymodule?ref_type=headsinstead of justhttps://gitlab.com/dagger-modules/private/test/more/dagger-test-modules-private, just because my browser selects the whole URL when clicking the address bar. Additionally, we developers are really lazy 😄: With the Copy URL button, I would typegit+ssh://, then hit Cmd+v, and finally hit Enter. When copying from the browser's address bar, I would copy the URL, being careful as some browsers like Chrome add anhttps://to the URL and require a second click to select the URL without the scheme, typegit+ssh://, hit Cmd+v, move the cursor back, and remove thehttps://if I accidentally copied it (looking at you, Chrome), type.git, and hit Enter. That's why I prefer to use the Copy URL button. On the other hand, I guess most module developers will write READMEs that include a copy-paste line. In CI, we use HTTPS anyway.grouville commentedon Aug 2, 2024
Thanks @skycaptain,
Your feedback helped reassessing the DX 🙏.
Following your comments, with @aluzzardi, we paused a bit after your feedback and tried to think on a first-principle basis about:
github.com/aluzzardi/daggerversehttps://github.com/dagger/dagger.git[email protected]:dagger/dagger.gitYou're right, the scope of the issue is to come up with the proper ref style, where DX is the most important component. It needs to be intuitive / easy to read and not too verbose for users.
Context
Lastly, the current effort with the very explicit ref style (the one with
git+ssh://) was introduced to be computationally correct, at the expense of the DX. This format helps to have a unified ref for both modules AND dir / file passed as CLI arguments.Now, after reflexion, Andrea came up with a series of postulates that could help scoping the ref style:
dagger install/dagger -m ...by the user, which shall optimize for ease-of-use / familiarity / and clarity ; however, it is ok for its canonical reference or internal reference inside thedagger.jsonto be more explicitgit rewrite rulesare not ideal, as they bring the resolving logic client-side, which impacts the ci / local unificationGiven that postulate, these 3 ref styles are all pretty solid schemes to support:
HTTPs
[proto]host/path[.git][subpath][@version]with proto:
https://orhttp://, which are the proto proposed by default on the copy button of all Git providersThis introduces a retro-compatible ref-format with an easy mono-repo handling: copy-paste the button from GitHub, add the path and the version, you're good to go. Easy-to-do, easy to remember.
The risk of a ref for http that supports Go-like style and Git-HTTP style is that we could end up with a lot of variations of those refs as valid:
E.g
cc @aluzzardi, I do not remember, when we discussed, did you intend for us to be more strict on the ref format ?
On the contrary, when thinking about it, I have the feeling that not including the proto and continuing full-on as a go-style ref for HTTP is also acceptable. People can copy the ref and just remove the
http/httpsproto themselves. They're doing it right now, and it's not that painful. At least, it is for sure not as painful to delete than to writegit+ssh://.WDYT @skycaptain ? @aluzzardi ?
No strong opinion, I just worry about the amount of variations we would see popping up with a more loose scheme.
Remaining on go-like format would look like:
host/path[.git][subpath][@version]SSH refs
Here, we do full SCP-like format. This is the alternative format proposed as the default SSH ref in the copy buttons of those git providers:
[user@]host:path[.git][subpath][@version]The distinction is indeed the
:, which enforces the SSH protocolWhen not set,
usercould be inferred asgit(or not?). We could enforce its presence. Same question as above, do we also expect the.git? (to be wary of all potential variations this implies)E.g
In both those examples, users are encouraged to just copy-paste from the provider.
You're on a monorepo ? Just append the subpath ; Need a version ? Just add
@and a version after.Easy to remember, easy to do
Daggerverse impact
Also, both formats are pretty similar and their ref formats can totally be copy-pasted and tweaked to a Daggerverse URL
Let's take for example: https://daggerverse.dev/mod/github.com/levlaz/daggerverse/docusaurus@6c7c28cd95a9636a04768c8de8b658d724cdecb3.
The current ref is:
github.com/levlaz/daggerverse/[email protected], to which, the version is resolved to the actual commit in the URL.Let's try to see a few of those variations for all the supported protocols with the new ref scheme:
github.com/levlaz/daggerverse/[email protected]https://github.com/levlaz/daggerverse.git/[email protected][email protected]:levlaz/daggerverse.git/[email protected]And that all these examples would continue to lead to the same Daggerverse URL:
https://daggerverse.dev/mod/github.com/levlaz/daggerverse/docusaurusIf i were to see such ref in any
dagger.jsonor any repo, finding the equivalent valid daggerverse representation is quite easy::into/There is also a path for the daggerverse to redirect to the proper modules, even with the SSH ref format?
cc WDYT @jedevc ?
jedevc commentedon Aug 2, 2024
Ahh I see the logic for wanting to support scp-style git URLs - I guess I'm happy with it, since users can just do the copy and paste. That's the most important feature (my bad). Also happy to kill the
git+sshidea.There's one case missing in the above I think -
ssh://[email protected]/dagger/dagger.git/[email protected], or similar. While not copy-pasteable in the GitHub UI, users might attempt to use it and there's really no added cost to us to support it.One note from a parsing perspective - having two
@s in a ref url is tricky, parsing off the optional version at the end needs to be done carefully.grouville commentedon Nov 7, 2024
Closed by #8805