operation timedout while publishing artifacts to gitlab using goreleser

432 views Asked by At

I am using golang to create a simple CLI application. I am using GoReleaser to release this to Gitlab. I followed the steps outlined in https://goreleaser.com/quick-start/ to release changes to gitlab. I have generated a personal access token with API scope. I am tagging the changes and pushing them before I use the goreleaser to publish artifacts.

I always get the error which says release failed after 452.34s error=github/gitlab/gitea releases: failed to publish artifacts: Get "https://PRIVATEGITLABURL/api/v4/projects/PRIVATE_GITLAB_PROJECT/releases/v1%2E0%2E3": dial tcp IP_ADDRESS:443: connect: operation timed out.

My .gorelease.yml file

before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy
    # you may remove this if you don't need go generate
    - go generate ./...
builds:
  - env:
      - CGO_ENABLED=0
    goos:
      - windows
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'
# .goreleaser.yml
gitlab_urls:
  api: https://PRIVATE_GITLAB_REPO/api/v4/
  download: https://PRIVATE_GITLAB_REPO
  # set to true if you use a self-signed certificate
  skip_tls_verify: false 

Any Ideas? My gitlab version is GitLab Enterprise Edition 14.1.5-ee

1

There are 1 answers

3
VonC On

Check first if this is because of goreleaser/goreleaser issue 1879 (" Using goreleaser behind a http(s) proxy "), which is supported since PR 1885 and goreleaser v0.147.0:

  • either your GitLab server is accessible through internet, and you have not set HTTP(S)_PROXY environment variables
  • or your GitLab server is on your intranet, you have set HTTP(S)_PROXY, but forgot the NO_PROXY (to not use the proxy when accessing through https:// an intranet resource).

Batuhan Apaydın suggests in the OP's discussion to apply the gitlab configuration:

# .goreleaser.yml
release:
  # Default is extracted from the origin remote URL or empty if its private hosted.
  # You can also use Gitlab's internal project id by setting it in the name
  #  field and leaving the owner field empty.
  gitlab:
    owner: user
    name: repo. 

The OP GrailsTest confirms, from GH discussion, in the comments:

I could not push my release as I can only access GitLab via SSH.
HTTP does not seem to work. Https has never worked on my machine, possibly because I have not set environment variables.

I could get this working on my colleagues machine who can access GitLab via HHTPS and SSH.