-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/vgo: not working with GitHub Enterprise #24076
Comments
|
Yes, I just realized that as well. This is still workable when using the normal go build, though, because we can (and do) manually checkout our internal repos into our $GOPATH/src tree. That doesn't seem to be an option with vgo, unless I've missed something. |
I don't know much about GitHub Enterprise. Does it have similar APIs to public GitHub? It is possible this could work better with vgo than old go get. If the tag said something like githubenterprise to tell us it was that kind of server, we could use those APIs. |
Can you give me an example request? I'm happy to make it against something in our repo and give you the resulting output. |
The APIs are the same (except for the base path) but It would be great to think about this case from the beginning! I opened a similar issue when |
This is an issue which has caused me a fair amount of pain. See https://go-review.googlesource.com/c/go/+/37176 for a simple fix for the go get case in go-1.10 |
FWIW, i have been collecting a group of company GHE customers to try to influence GitHub to actually fix this problem. (it exists in GitHub itself, as well, but it's masked by having static rules that cover it) |
Hi @sdboyer
|
Does |
@amnonbc & @sdboyer,
They also added this:
|
@james-r-smith yes we use the former hack as a workaround at the moment. |
@amnonbc, I wholeheartedly agree. |
With the GitHub Enterprise 2.13 release, on-premises GitHub Enterprise instances will now send the For instances that are in private mode, you will still need to manage authentication for the
|
There's a header we can look for in the go-get response to understand that this is a GitHub Enterprise server and can be accessed using the usual GitHub code. We should do that. |
Change https://golang.org/cl/107657 mentions this issue: |
Change https://golang.org/cl/107656 mentions this issue: |
A goal of introducing modules was to move away from invoking version control tools directly, but it has become clear that we're not ready to do that today. GitHub in particular imposes draconian limits on HTTPS API access that they don't impose on ordinary Git access. And we can avoid for now breaking company setups using private Git servers. Because GitHub Enterprise now serves ?go-get=1 queries in a way that is compatible with old go get, dropping back to version control tools makes that compatible with vgo too. The next CL hooks this code into the rest of vgo. For golang/go#24915. For golang/go#23955. For golang/go#24076. Change-Id: I76bea30081047ab68286a5d095a0d55872c5a1a3 Reviewed-on: https://go-review.googlesource.com/107656 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
I see that this is marked as closed, but I've been unable to find an example of the solution. I have private repos that will require API keys in deployment environments and I'm trying to figure out where I tell go.mod "when you see this import, construct this url with this token instead of whatever you would normally do". So in the case of
The end result should be
Can anyone give me an update on the best practice way to accomplish this? Something that doesn't require modifying an existing server would be preferred. |
@coolaj86 - could you use SSH keys instead of tokens (that's how I believe the authentication to GitHub Enterprise server normally works)? If so, you can add to your (and everyone's in your org 😭 )
if (with a bit of luck such as GHE >= 2.13 - https://enterprise.github.com/releases/2.13.0/notes) your Git server replies to requests from the I really wish #17898 and @matope's https://go-review.googlesource.com/c/go/+/37176 could be revisited and finished - so that it wouldn't be necessary for all users to "hack" their Now suppose you don't have yet such a wonderful server support (GHE < 2.13 etc.) - you can still make the
The replace pattern can also be applied to use custom git mirrors (let's assume
|
another option is to use personal access tokens with a credential helper - then you don't need to put @coolaj86 - I think this would fit your use case:
Would be curious if that works for you. |
Since I'm using jenkins which stored the username & password/access-token, my workaround is using a GIT_ASKPASS wrapper script git-askpass-wrapper.sh
It works because when git require credentials, it will call the wrapper script. You can modified the script to your need (for example, if you have different creds for different repo). |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64 vgo:2018-02-20.1
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rich/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rich/code/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s9/9s3fk2mx5f936dkcp66ltwsc0000gn/T/go-build062786983=/tmp/go-build -gno-record-gcc-switches -fno-common"
VGOMODROOT=""
What did you do?
Attempted to build some code that had dependencies on one or more packages that come from our internal GitHub repo as well as from the public github.com using the experimental
vgo
tool. As this refers to an internal repo (and that is the basis of the problem), there is no way for me to give you code that reproduces the problem that you can actually try. Suffice to say, though, that even the simplest import causes the issue.What did you expect to see?
I was hoping that GitHub Enterprise would work as well as normal GitHub.
What did you see instead?
The text was updated successfully, but these errors were encountered: