athens
athens copied to clipboard
Athens is ignoring the ATHENS_GO_BINARY_ENV_VARS
Describe the bug A clear and concise description of what the bug is. I'm trying to setup Athens to download private repos from a Gitlab server that's not running on HTTPS, but it seems like Athens ignores any go env vars I pass to the docker image I use.
Error Message When running the go get from some machine that is configured to use my athens server as a proxy:
go get -v my-gitlab-server.com/my-project/my-repo/...
I get the following error:
go get my-gitlab-server.com/my-project/my-repo/...: module my-gitlab-server.com/my-project/my-repo: reading https://pkg.my-proxy.com/my-gitlab-server.com/my-project/my-repo/@v/list: 404 Not Found
And the docker log for the request is:
INFO[8:27AM]: Exporter not specified. Traces won't be exported
2020-05-21 08:27:05.065337 I | Starting application at port :3000
INFO[8:27AM]: exit status 1: go list -m: my-gitlab-server.com/my-project@latest: unrecognized import path "my-gitlab-server.com/my-project": https fetch: Get "https://my-gitlab-server.com/my-project?go-get=1": dial tcp 35.240.229.163:443: connect: connection refused
http-method=GET http-path=/my-gitlab-server.com/my-project/@v/list kind=Not Found module= operation=download.ListHandler ops=[download.ListHandler pool.List protocol.List vcsLister.List] version=
INFO[8:27AM]: incoming request http-method=GET http-path=/my-gitlab-server.com/my-project/@v/list http-status=404
INFO[8:27AM]: exit status 1: go list -m: my-gitlab-server.com/my-project/my-repo@latest: unrecognized import path "my-gitlab-server.com/my-project/my-repo": https fetch: Get "https://my-gitlab-server.com/my-project/my-repo?go-get=1": dial tcp 35.240.229.163:443: connect: connection refused
http-method=GET http-path=/my-gitlab-server.com/my-project/my-repo/@v/list kind=Not Found module= operation=download.ListHandler ops=[download.ListHandler pool.List protocol.List vcsLister.List] version=
INFO[8:27AM]: incoming request http-method=GET http-path=/my-gitlab-server.com/my-project/my-repo/@v/list http-status=404
INFO[8:27AM]: exit status 1: go list -m: my-gitlab-server.com@latest: unrecognized import path "my-gitlab-server.com": https fetch: Get "https://my-gitlab-server.com/?go-get=1": dial tcp 35.240.229.163:443: connect: connection refused
http-method=GET http-path=/my-gitlab-server.com/@v/list kind=Not Found module= operation=download.ListHandler ops=[download.ListHandler pool.List protocol.List vcsLister.List] version=
INFO[8:27AM]: incoming request http-method=GET http-path=/my-gitlab-server.com/@v/list http-status=404
To Reproduce I run the Athens server with the following script:
#!/bin/bash
# Start Athens Go Proxy server
ATHENS_STORAGE=$PWD/athens-storage
ATHENS_DOWNLOAD_MODE_CONFIG=$PWD/config.toml
ATHENS_VER=v0.9.0
CONTAINER_NAME=athens-proxy
# Create the storage dir
mkdir -p $ATHENS_STORAGE
# Stop the current running instance
sudo docker stop $CONTAINER_NAME 2>/dev/null
# Remove the current container
sudo docker rm -v $CONTAINER_NAME 2>/dev/null
# Run container
sudo docker run -d \
-v "$ATHENS_STORAGE:/var/lib/athens" \
-v "$ATHENS_DOWNLOAD_MODE_CONFIG:/root/config.toml" \
-v "$PWD/.gitconfig:/root/.gitconfig" \
-v "$PWD/ssh-keys:/root/.ssh" \
-v "$PWD/.netrc:/root/.netrc" \
-e ATHENS_DOWNLOAD_MODE=file:/root/config.toml \
-e ATHENS_GO_BINARY_ENV_VARS='GOPRIVATE=my-gitlab-server.com/*; GONOSUMDB=my-gitlab-server.com/*' \
-e ATHENS_NETRC_PATH=/root/.netrc \
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \
-e ATHENS_STORAGE_TYPE=disk \
--name $CONTAINER_NAME \
--restart unless-stopped \
-p 3000:3000 \
gomods/athens:$ATHENS_VER
The config.toml
:
downloadURL = "https://proxy.golang.org"
mode = "async_redirect"
download "my-gitlab-server.com/my-project/*" {
mode = "sync"
}
The .gitconfig
:
[url "ssh://[email protected]/"]
insteadOf = https://my-gitlab-server.com
The .netrc
:
machine my-gitlab-server.com
login secret-user
password secret-pass
The .ssh/config
:
Host my-gitlab-server.com
Hostname my-gitlab-server.com
StrictHostKeyChecking no
IdentityFile /root/.ssh/id_rsa
Expected behavior It should fetch the private repo using ssh and not return 404.
Environment (please complete the following information):
- OS: Linux go-pkg-proxy 4.19.0-9-cloud-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64 GNU/Linux
- Go version : go1.13.4 linux/amd64
- Proxy version : Docker image v0.9.0
- Storage (fs/mongodb/s3 etc.) : disk
Additional context Add any other context about the problem here.
@rolandjitsu Hi Roland, I know this issue has been open for a while but have you managed to figure out what was wrong? I have the same problem...
@rolandjitsu Hi Roland, I know this issue has been open for a while but have you managed to figure out what was wrong? I have the same problem...
I don't think I got it working. My goal was to have the proxy download private repositories without having the user setup their machine to do that, but I couldn't figure out a way to do that. So I ended up not using the proxy and using docker buildx to build and do the auth required for getting private repos.
@rolandjitsu Hi Roland, I know this issue has been open for a while but have you managed to figure out what was wrong? I have the same problem...
I don't think I got it working. My goal was to have the proxy download private repositories without having the user setup their machine to do that, but I couldn't figure out a way to do that. So I ended up not using the proxy and using docker buildx to build and do the auth required for getting private repos.
Thanks, Roland, that makes sense.. I am not sure why is it not working..