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

Allow overriding GOPROXY #183

Closed
broom9 opened this issue Apr 1, 2022 · 3 comments · Fixed by #185, #187 or #189
Closed

Allow overriding GOPROXY #183

broom9 opened this issue Apr 1, 2022 · 3 comments · Fixed by #185, #187 or #189
Labels
question Further information is requested

Comments

@broom9
Copy link

broom9 commented Apr 1, 2022

GOPROXY=https://goproxy.cn,https://goproxy.io,direct

This line in Dockerfile is forcing us to use goproxy.cn, and it sometimes returns 504 Gateway Timeout and breaks our build. Can we make this configurable or overridable from an env var? Thanks.

go: [gopkg.in/[email protected]:](http://gopkg.in/[email protected]) reading [https://goproxy.cn/gopkg.in/fsnotify.v1/@v/v1.4.7.mod:](https://goproxy.cn/gopkg.in/fsnotify.v1/@v/v1.4.7.mod) 504 Gateway Timeout
The command '/bin/sh -c go mod download -x' returned a non-zero code: 1```
@wchaws
Copy link
Contributor

wchaws commented Apr 2, 2022

@broom9 According to GOPROXY doc, it will fallback to the next proxy if go command encountered an error. However, the behavior between comma split(,) and pipe split(|) list is different. I think we should change from comma split to pipe split, because it looks more robust. Again, I don't against to let user to override GOPROXY env. But since cdk-ecr-deployment already pre-built golang binary, I don't understand why we still need to built from scratch?

The go command may be configured to contact proxies or source control servers using the GOPROXY environment variable, which accepts a list of proxy URLs. The list may include the keywords direct or off (see Environment variables for details). List elements may be separated by commas (,) or pipes (|), which determine error fallback behavior. When a URL is followed by a comma, the go command falls back to later sources only after a 404 (Not Found) or 410 (Gone) response. When a URL is followed by a pipe, the go command falls back to later sources after any error, including non-HTTP errors such as timeouts.

@wchaws wchaws added the question Further information is requested label Apr 2, 2022
@broom9
Copy link
Author

broom9 commented Apr 2, 2022

Thanks. I agree pipe looks more robust. It might be better to not default to any proxy server but allow configuring it via an env var or option.

The code logic is to rebuild the image from scratch if on CI (when the CI env var is set to 1). So this issue happened in our CI pipelines.

@marcin-kwasnicki
Copy link

@wchaws Hi, can your change with the GOPROXY separator be also added to v1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
3 participants