#Using private go packages in dagger module?

1 messages · Page 1 of 1 (latest)

mighty trail
#

How would I need to configure my ssh/git configs so dagger develop can pull a private go dep in my module?

  github.com/private-org/some-package
)

I can't get to use ssh instead of https when pulling the private dep, despite having my git config with

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

Always getting into...

fatal: could not read Username for 'https://github.com': terminal prompts disabled
mighty trail
#

It does not matter if I get the SSH_AUTH_SOCK setup and load the ssh keys either...

#

(as clearly is not using SSH 🙂 )

vast wraith
#

I don't think it's currently supported. @mighty trail mind creating an issue for that?

#

cc @marsh swift I think you might know the answer to this one

mighty trail
#

I've been digging a bit more into it... I now realize all that work happens inside the engine, which obvioulsy has no awareness of ssh/git configs in the machine i may be calling from

marsh swift
#

I can sort of help? I don't use SSH so I'm familiar with setting that up for private modules. However, have you set GOPRIVATE?

mighty trail
#

I'll open an issue with this

marsh swift
#

And anything else you need like proxies etc. For proxies you have to set them in a custom engine image.

mighty trail
#

Yeah, that is what I was afraid of after looking more in depth. I would need to bake a custom engine image that has git/ssh permissions to pull private repositories from my org

marsh swift
#

The custom image is only for proxy configurations. I don't think setting up gitconfig or SSH in a custom engine image works

#

For that, you have to set it up when you run the git commands

#

For SSH, I think there's a way to pass the SSH_AUTH_SOCK to the engine but I am not familar with that workflow as I don't use SSH

#

You can have a pre-baked image (not engine) that has your git setup and pull that down when you need to run git commands. That's what I'd do

mighty trail
#

Mmm.. I'm not sure I follow, or we're talking about the same 😅

I am developing a module, in golang, that needs private go modules
When I try to generate the code (dagger develop), the engine is unable to pull those private dependencies (obvioulsy)

I am not trying to run git commands/access private dagger modules.

#

I think the engine needs some customisation to be able to pull those private go mods:
gitconfig with authentication that the engine reads when trying to pull those go deps (something like):
git config --global url.https://x-access-token:${GH_TOKEN}@github.com/.insteadOf https://github.com/

#

But not quite sure yet how that works internally (engine executing codegen ) and how can I affect the environment where codegen is running

#

I'll keep digging

marsh swift
#

ohh ok sorry I misunderstood. Yes, you'll need that set up in a custom engine image. The engine pulls in certain env vars like proxy and GOPRIVATE but I am not sure it supports auth for private modules. I agree with @vast wraith . Probably better to open an issue.

mighty trail
#

thanks. I was going through the 6599 issue.
The docs don't mention the support for _DAGGER_ENGINE_SYSTEMENV_GOPROXY, which may be a way for us to workaround this..

vast wraith
#

and we don't have those hooks yet in the engine to pass it to the Go runtime container AFAIK. cc @formal solar

#

I think this deserves its own issue as I couldn't find one specifically related to this.

marsh swift
#

a private GOPROXY which proxies both public and private go modules could be used as a workaround. But I don't think that's necessarily a solution to this problem as that requires infrastructure.