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
feat: support templates for scm urls #2465
feat: support templates for scm urls #2465
Conversation
@steveazz is attempting to deploy a commit to the goreleaser Team on Vercel. A member of the Team first needs to authorize it. |
Hey! Thanks for the kind word and for the PR. Can you do the same for github and gitea? (just so we have feature parity) Would also be neat to add a note the docs saying its templateable, but I can do that later if you like Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #2465 +/- ##
==========================================
+ Coverage 83.02% 83.87% +0.84%
==========================================
Files 87 87
Lines 6275 6318 +43
==========================================
+ Hits 5210 5299 +89
+ Misses 915 866 -49
- Partials 150 153 +3
Continue to review full report at Codecov.
|
f15637e
to
47cb4db
Compare
You can use GoReleaser with GitLab Enterprise by providing its URLs in | ||
the `.goreleaser.yml` configuration file: | ||
You can use GoReleaser with GitLab Enterprise by providing its URLs in the | ||
`.goreleaser.yml` configuration file. This takes a normal string or a template value. | ||
|
||
```yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: Not sure if we want to give a commented example here that it can support templates as well like below
# .goreleaser.yml
gitlab_urls:
# api: "{{ .ENV. CI_API_V4_URL }}
api: https://gitlab.mycompany.com/api/v4/
download: https://gitlab.company.com
# set to true if you use a self-signed certificate
skip_tls_verify: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need IMHO, docs are clear enough 🙏
Background --- When a git repository is hosted in multiple GitLab instances the `.goreleaser.yml` needs to take in consideration both APIs endpoints. At the moment it defaults to GitLab.com and you can override it with `gitlab_urls` however this forces you to only support 1 GitLab instance. We need this for https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14122 where we have a tool that is developed on GitLab.com but then mirrored to an internal GitLab instance since we need it to operate GitLab.com even when it's down. Solution --- Support templates like `{{ .Env.CI_SERVER_URL }}` for the `gitlab_urls`, `github_urls` and `gitea_urls` so it can use environment variables and the same `.goreleaser` file can be used in multiple SCM instances.
47cb4db
to
5990348
Compare
@caarlos0 this should be ready for another round of review! Let me know what you think and I'm sorry it turned out to be a large PR 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for this really well polished project and the hard work put into it 🙌
Background
When a git repository is hosted in multiple GitLab instances the
.goreleaser.yml
needs to take in consideration both APIs endpoints. Atthe moment it defaults to GitLab.com and you can override it with
gitlab_urls
however this forces you to only support 1 GitLab instance.We need this for
https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14122
where we have a tool that is developed on GitLab.com but then mirrored
to an internal GitLab instance since we need it to operate GitLab.com
even when it's down.
Solution
Support templates like
{{ .Env.CI_SERVER_URL }}
for thegitlab_urls
,github_urls
andgitea_urls
so it can use environmentvariables and the same
.goreleaser
file can be used in multiple SCMinstances.