mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-13 11:50:34 +02:00
feat: gitlab option to use_job_token (#2993)
This commit is contained in:
parent
4dc372d784
commit
5cfc78d92c
@ -44,7 +44,14 @@ func NewGitLab(ctx *context.Context, token string) (Client, error) {
|
|||||||
|
|
||||||
options = append(options, gitlab.WithBaseURL(apiURL))
|
options = append(options, gitlab.WithBaseURL(apiURL))
|
||||||
}
|
}
|
||||||
client, err := gitlab.NewClient(token, options...)
|
|
||||||
|
var client *gitlab.Client
|
||||||
|
var err error
|
||||||
|
if ctx.Config.GitLabURLs.UseJobToken {
|
||||||
|
client, err = gitlab.NewJobClient(token, options...)
|
||||||
|
} else {
|
||||||
|
client, err = gitlab.NewClient(token, options...)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &gitlabClient{}, err
|
return &gitlabClient{}, err
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ type GitLabURLs struct {
|
|||||||
Download string `yaml:"download,omitempty" json:"download,omitempty"`
|
Download string `yaml:"download,omitempty" json:"download,omitempty"`
|
||||||
SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
|
SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
|
||||||
UsePackageRegistry bool `yaml:"use_package_registry,omitempty" json:"use_package_registry,omitempty"`
|
UsePackageRegistry bool `yaml:"use_package_registry,omitempty" json:"use_package_registry,omitempty"`
|
||||||
|
UseJobToken bool `yaml:"use_job_token,omitempty" json:"use_job_token,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GiteaURLs holds the URLs to be used when using gitea.
|
// GiteaURLs holds the URLs to be used when using gitea.
|
||||||
|
@ -30,11 +30,16 @@ You can use GoReleaser with GitLab Enterprise by providing its URLs in the
|
|||||||
gitlab_urls:
|
gitlab_urls:
|
||||||
api: https://gitlab.mycompany.com/api/v4/
|
api: https://gitlab.mycompany.com/api/v4/
|
||||||
download: https://gitlab.company.com
|
download: https://gitlab.company.com
|
||||||
|
|
||||||
# set to true if you use a self-signed certificate
|
# set to true if you use a self-signed certificate
|
||||||
skip_tls_verify: false
|
skip_tls_verify: false
|
||||||
|
|
||||||
# set to true if you want to upload to the Package Registry rather than attachments
|
# set to true if you want to upload to the Package Registry rather than attachments
|
||||||
# Only works with GitLab 13.5+
|
# Only works with GitLab 13.5+
|
||||||
use_package_registry: false
|
use_package_registry: false
|
||||||
|
|
||||||
|
# Set this if you set GITLAB_TOKEN to the value of CI_JOB_TOKEN:
|
||||||
|
use_job_token: true
|
||||||
```
|
```
|
||||||
|
|
||||||
If none are set, they default to GitLab's public URLs.
|
If none are set, they default to GitLab's public URLs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user