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

Using goreleaser behind a http(s) proxy #1879

Closed
thiago opened this issue Oct 29, 2020 · 5 comments · Fixed by #1885
Closed

Using goreleaser behind a http(s) proxy #1879

thiago opened this issue Oct 29, 2020 · 5 comments · Fixed by #1885
Assignees
Labels
bug Something isn't working good-first-issue

Comments

@thiago
Copy link

thiago commented Oct 29, 2020

Describe the bug

I'm using goreleaser to publish on gitlab behind a proxy. But the goreleaser is not using the proxy to call the gitlab endpoint.

I'm exporting HTTP_PROXY, HTTPS_PROXY, http_proxy and https_proxy and it is not working.

Looking the code and using the --debug flag, I can saw that most of commands are executed directly in the "terminal", like docker and git. But when will update the description of release page, goreleaser is calling it using a custom http transport ( https://github.com/goreleaser/goreleaser/blob/master/internal/client/gitlab.go#L30 ).

I think we need to use the ProxyFromEnvironment like the builtin DefaultTransport RoundTripper. Please, see https://golang.org/src/net/http/transport.go#L42

To Reproduce

Steps to reproduce the behavior:

export HTTP_PROXY=http://myproxy:3128
export HTTPS_PROXY=http://myproxy:3128
goreleaser
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env:
  - CGO_ENABLED=0
  - GOPRIVATE=gitlab.com/trsouz
before:
  hooks:
    - go mod download -x
builds:
  - goos:
      - darwin
      - linux
    goarch:
      - amd64
    ldflags:
      - -w -s
      - -X {{.Env.GOPRIVATE}}/{{.ProjectName}}/version.GitCommit={{.ShortCommit}}
      - -X {{.Env.GOPRIVATE}}/{{.ProjectName}}/version.Version={{.Version}}
      - -X {{.Env.GOPRIVATE}}/{{.ProjectName}}/version.BuildTime={{.Date}}
      - -X {{.Env.GOPRIVATE}}/{{.ProjectName}}/version.OS={{.Os}}
      - -X {{.Env.GOPRIVATE}}/{{.ProjectName}}/version.Arch={{.Arch}}
archives:
  - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
    replacements:
      darwin: Darwin
      linux: Linux
      windows: Windows
      386: i386
      amd64: x86_64
checksum:
  name_template: '{{ .ProjectName }}_checksums.txt'
snapshot:
  name_template: "{{ .Tag }}-next"
dockers:
  - image_templates:
      - registry.{{.Env.GOPRIVATE}}/{{.ProjectName}}:{{ .Tag }}
      - registry.{{.Env.GOPRIVATE}}/{{.ProjectName}}:v{{ .Major }}
      - registry.{{.Env.GOPRIVATE}}/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}
    goos: linux
    goarch: amd64
    build_flag_templates:
      - "--pull"
      - "--label=org.opencontainers.image.created={{.Date}}"
      - "--label=org.opencontainers.image.name={{.ProjectName}}"
      - "--label=org.opencontainers.image.revision={{.FullCommit}}"
      - "--label=org.opencontainers.image.version={{.Version}}"
changelog:
  sort: asc

  filters:
    exclude:
      - '^docs:'
      - '^test:'

Make sure your config file is valid by running
goreleaser check -f path-to-config-file.

Expected behavior

I expected that goreleaser uses the proxy to access external endpoints

Environment (please complete the following information):

  • OS: linux
  • OS version: Linux runner-9by1bn8-project-21635938-concurrent-0d64t6 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 Linux
  • GoReleaser Version
goreleaser version 0.146.0
commit: f629ac74edd09c2c6f59cb1b7473f199bb5b2231
built at: 2020-10-28T13:35:45Z
built by: goreleaser

Additional context

release failed after 459.17s error=github/gitlab/gitea releases: failed to publish artifacts: Get "https://gitlab.com/api/v4/projects/trsouz%2Fzenimon/releases/v0.0.1": dial tcp 172.65.251.78:443: connect: connection timed out

@thiago thiago added the bug Something isn't working label Oct 29, 2020
@caarlos0
Copy link
Member

Thanks! Happy to accept a patch for this.

@srinikhil-07
Copy link

@caarlos0
Is @thiago working on it or shall i give it a try ?

@caarlos0
Copy link
Member

caarlos0 commented Nov 1, 2020

Is @thiago working on it or shall i give it a try ?

afaik no, feel free to give it a try yes :)

@thiago
Copy link
Author

thiago commented Nov 3, 2020

Sorry the delay guys, I'm not working on it, but I can try if nobody is doing. Thanks

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good-first-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants