dagger icon indicating copy to clipboard operation
dagger copied to clipboard

✨ Support downloading modules from other git hosters

Open LuminatiHD opened this issue 1 year ago • 2 comments

What are you trying to do?

Since the dagger documentation only mentions installing modules from github, I tested if you could also install a module from another git hoster, like gitlab in my example. I tried installing from a repository with a path of the form group/subgroup_1/subgroup_2/project. But since dagger (probably) assumes the repo path to be like github's, as in <user_or_org>/project, it tried to pull the project group/subgroup_1, which obviously doesn't exist.

Why is this important to you?

I think it's generally a good idea to support other git hosters. Gitlab in particular would be great, since it would allow one to set access permissions to certain pipeline modules.

How are you currently working around this?

As pointed out, I only did this as a test, so for me, there isn't really a problem to sidestep at the moment.

LuminatiHD avatar Jul 11 '24 08:07 LuminatiHD

Hi 👋 Can you please provide the corresponding module ref you are using ? This should work 👀

We currently test that: https://github.com/dagger/dagger/blob/main/core/integration/module_config_test.go#L1379. Is it possible that one of the group is private ?

In that case, unfortunately GitLab hides the true root of the repo (by design) when working with a private repo / groups: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/middleware/go.rb#L210-221

To fix that, I recommend adding the .git where the separation between the root of the repo and the subpath resides. This way, you ensure that we correctly parse the root of the repo.

In our example, this would be: gitlab.com/dagger-modules/test/more/dagger-test-modules-public.git

P.S: private git support is under development

grouville avatar Jul 11 '24 08:07 grouville

Oh I see. Yes, it is a private group. Using your fix works, except that now it fails with what I assume is an authentication issue. But as you said, you're already working on that. Thanks a lot for your help.

LuminatiHD avatar Jul 11 '24 11:07 LuminatiHD

@grouville I'm very excited to see enterprise use cases picked up with private git hosters. As part of this feature can we make sure that Azure Devops is supported? It requires token injection to work w/ https here's a sample gitconfig with some redaction:

[url "https://anything:{{ ado_pat }}@dev.azure.com"]
  insteadOf = "https://{{ org }}@dev.azure.com"

Browser urls: https://dev.azure.com/{{ org }}/{{ project }}/_git/{{ git_repo }} Sample clone: git clone https://{{ org }}@dev.azure.com/{{ org }}/{{ project }}/_git/{{ git_repo }}

I can raise a separate issue/feature request if you like.

bradfordwagner avatar Jul 19 '24 13:07 bradfordwagner

Browser urls: https://dev.azure.com/{{ org }}/{{ project }}/_git/{{ git_repo }}

Hey @bradfordwagner, your use-case should work right now. Resolved by #8805

grouville avatar Nov 07 '24 23:11 grouville