goreleaser: GitLab Brew Tap Problem
What happened?
Hi, I’m trying to create a new brew tab on GitLab and getting some errors.
When I looked into the problem, I noticed that;
normally pattern should be like this: /api/v4/projects/:projectId/repository/files/:file_path?ref=branch
(GitLab API Docs of the related endpoint)
but goreleaser is sending in this pattern: /api/v4/projects/:owner/:name/repository/files/:file_path?ref=branch
and this reason, GitLab API returns the ‘404 Project Not Found’ error.
Error in GitLab CI:
Here is my configuration:
(I tried to set owner empty to bypass this problem, but it’s not work for create file section)
brews:
- tap:
owner: ""
name: "11787"
branch: master
token: "{{ .Env.GITLAB_TOKEN }}"
Problem-related links: https://github.com/goreleaser/goreleaser/blob/main/internal/client/gitlab.go#L133 https://github.com/goreleaser/goreleaser/blob/main/internal/client/client.go#L38-L43
How can we reproduce this?
gitlab_urls:
api: https://gitlab.company.com/api/v4/
download: https://gitlab.company.com
skip_tls_verify: false
use_package_registry: true
brews:
- tap:
owner: ""
name: "projectID"
branch: master
token: "{{ .Env.GITLAB_TOKEN }}"
name: project-name
goreleaser version
goreleaser version 1.5.0
commit: 55d7eabc79d41e073cc4592c350c1f4c7f527eb3
built at: 2022-02-12T17:22:26Z
built by: goreleaser
goos: darwin
goarch: amd64
module version: v1.5.0, checksum: h1:l4BxBt2Rrk5Tngmzyrcp7H/CszXSA0guzL4mPo4peAU=
GoReleaser Check
- goreleaser check shows no errors
Search
- I did search for other open and closed issues before opening this.
Code of Conduct
- I agree to follow this project’s Code of Conduct
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (10 by maintainers)
@caarlos0 you can assign it to me, I can take care of that one.
hey @TanZng, feel free to give this a shot!
@mnkg561 there’s a note on docs saying it needs gitlab 12.9+: https://goreleaser.com/scm/gitlab/
Done, thanks 🙏
An
owner/name
pair does not identify a GitLab repository. Old versions of goreleaser hadbrew.github
yaml path to identify a GitHub repo to create formulae files on. Now,brews.[:id].tap
is aRepoRef
that is a collection ofowner/name/branch
which does not make sense for GitLab impl.The following query returns a 404:
https://gitlab.com/api/v4/projects/gitlab-org/gitlab-foss/repository/files/.dockerignore?ref=master
whereas this succeeds (expectedly)
https://gitlab.com/api/v4/projects/13083/repository/files/.dockerignore?ref=master
Going from
owner/name
toprojectID
is not simple as far as I can see, as GitLab categorizes project ownership under either a single user or a group, soapi/v4/users/<owner-name>/projects
orapi/v4/groups/<name>/projects
are needed to be checked to fetch theprojectID
.Using only the
name
field as a workaround so that GitLabprojectID
can be correctly plugged into the URL, is one easy way out of this, but it is not explicit and will be a “bazinga” moment for all GitLab users.