#How to Use a Private Go Module with dagger

1 messages ยท Page 1 of 1 (latest)

thin dragon
#

Is there any easy or recommended way to build projects with private go modules? I can use GITHUB TOKEN and GOPRIVATE combination in git config but I prefer keep GITHUB_TOKEN out of this workflow if it's possible

dreamy saddle
#

๐Ÿ‘‹ @thin dragon what are you using CUE or the new Dagger SDK's?

thin dragon
#

I'm using new dagger sdk

dreamy saddle
#

for local builds dagger will automatically use your ssh-agent, so fetching libs from private repos should work out of the box.

#

when you run in CI (i.e github actions) you need to send your GH_ACCESS_TOKEN and GOPRIVATE vars so GH can fetch from there

weary mango
weary mango
dreamy saddle
weary mango
dreamy saddle
#

cc @potent rapids do we have any examples in the meantime that use GOPRIVATE and a token to fetch private go repos?

potent rapids
thin dragon
weary mango
#

@astral heart

thin dragon
#

I also tried to replicate SSH_AGENT socket but as descripted in issue above , I couldn't find it in latest API

#

For token authentication, it's already disabled in remote: Support for password authentication was removed on August 13, 2021.

#

Currently I'm looking for alternative solutions like credential helper

weary mango
#

I need to add the tests, and get feedback

thin dragon
#

Great ๐Ÿ™ thanks for quick update

#

I also find an workaround

weary mango
thin dragon
#

_, err = client. Container(). From("golang:1.19"). WithSecretVariable("GH_TOKEN", githubTokenID). Exec(dagger.ContainerExecOpts{ Args: []string{ "bash", "-ec", curl --location --fail --silent --show-error https://github.com/cli/cli/releases/download/v2.19.0/gh_2.19.0_linux_amd64.tar.gz | tar -C . -xz && mv gh_2.19.0_linux_amd64/bin/gh /usr/local/bin/gh, }, }). Exec(dagger.ContainerExecOpts{Args: []string{"bash", "-c", "gh auth setup-git"}}).

#

I guess with gh as credential helper I wont need to change auth workflow in GHA executions as well