Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue installing private packages #29

Open
vinceau opened this issue Aug 13, 2019 · 8 comments
Open

Issue installing private packages #29

vinceau opened this issue Aug 13, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@vinceau
Copy link

vinceau commented Aug 13, 2019

Many thanks for extending the original xgo package and introducing go mod support.

I'm having an issue where private packages are not being installed on build. When trying to build, I get issues like this:

go: github.com/some_private_repo git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/...: exit status 128:
        fatal: could not read Username for 'https://github.com': terminal prompts disabled

Running go get works fine on the local machine since I have in the ~/.gitconfig file:

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

Any ideas?

@techknowlogick
Copy link
Owner

Which CI server do you use? Perhaps it is possible to run git config... to swap the git clone paths before running xgo (assuming you are running xgo inside the container instead of having xgo itself spin up container). For example the Gitea project runs custom commands in xgo container using drone to customize things before compile.

@vinceau
Copy link
Author

vinceau commented Aug 13, 2019

I wasn't using a CI server actually, I was just running xgo locally on my machine (i.e. having xgo spin up the container itself). Should I not be doing that?

@techknowlogick
Copy link
Owner

Oh no, that's a totally acceptable usecase. Feel free to continue using this that way.

I wonder how we could achieve updating the git config inside the container. There are a few options off the top of my head, 1. use an env var to let container know to mount in git config 2. use an argument that takes git config info and runs that first. 3. something similar.

I think the above may also need to inject an SSH key in too (if we don't already) so that auth can be correct too. Perhaps mount the entire ~/.ssh directory as read only.

I think perhaps we may need to think about this more in depth, at least more than what I have above, as it likely affects gitlab (and other git forges such as Gitea), so having a generic way of doing whatever is planned is best.

@kolaente kolaente added the enhancement New feature or request label Sep 24, 2019
@astockwell
Copy link

astockwell commented Oct 18, 2019

I do the same as @vinceau, running xgo locally, and have run into the same challenge. One possible (though somewhat hamfisted) solution might be to allow go build -mod flags to be passed into xgo? Such that xgo could be told to use the ./vendor directory of the project for dependencies, presumably including private repos? Granted this means you have to locally vendor/cache everything..

@LogicalChaos
Copy link

Same problem, any hope on a solution? The -mod flag would be fine by me, as our build is controlled via Makefile, so that's just a dependency to add.

@futureimperfect
Copy link

Same problem here. The -mod flag would be fine by me as well.

@f-person
Copy link

f-person commented Jan 15, 2022

Is there any way to build a private (or at least local) repo? There doesn't seem to be a -mod flag anymore

Edit: pointing to the local directory instead of module name works

@tuxillo
Copy link
Contributor

tuxillo commented Jul 13, 2023

What's the recommended way to build locally when there are dependencies in private repos?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants