mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 17:54:07 +01:00
Allow to change status context again (#674)
* use flag value * fix test * sed -i 's/STATUS_CONTEXT/WOODPECKER_STATUS_CONTEXT/g' * docs * Update docs/docs/91-migrations.md Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
@@ -7,10 +7,8 @@ import (
|
||||
"github.com/woodpecker-ci/woodpecker/server/model"
|
||||
)
|
||||
|
||||
const base = "ci/woodpecker"
|
||||
|
||||
func GetBuildStatusContext(repo *model.Repo, build *model.Build, proc *model.Proc) string {
|
||||
name := base
|
||||
name := server.Config.Server.StatusContext
|
||||
|
||||
switch build.Event {
|
||||
case model.EventPull:
|
||||
|
||||
@@ -57,7 +57,6 @@ type Gitea struct {
|
||||
// Opts defines configuration options.
|
||||
type Opts struct {
|
||||
URL string // Gitea server url.
|
||||
Context string // Context to display in status check
|
||||
Client string // OAuth2 Client ID
|
||||
Secret string // OAuth2 Client Secret
|
||||
Username string // Optional machine account username.
|
||||
@@ -79,7 +78,6 @@ func New(opts Opts) (remote.Remote, error) {
|
||||
}
|
||||
return &Gitea{
|
||||
URL: opts.URL,
|
||||
Context: opts.Context,
|
||||
Machine: u.Host,
|
||||
ClientID: opts.Client,
|
||||
ClientSecret: opts.Secret,
|
||||
|
||||
@@ -46,14 +46,12 @@ func Test_gitea(t *testing.T) {
|
||||
g.It("Should return client with specified options", func() {
|
||||
remote, _ := New(Opts{
|
||||
URL: "http://localhost:8080",
|
||||
Context: "continuous-integration/test",
|
||||
Username: "someuser",
|
||||
Password: "password",
|
||||
SkipVerify: true,
|
||||
PrivateMode: true,
|
||||
})
|
||||
g.Assert(remote.(*Gitea).URL).Equal("http://localhost:8080")
|
||||
g.Assert(remote.(*Gitea).Context).Equal("continuous-integration/test")
|
||||
g.Assert(remote.(*Gitea).Machine).Equal("localhost")
|
||||
g.Assert(remote.(*Gitea).Username).Equal("someuser")
|
||||
g.Assert(remote.(*Gitea).Password).Equal("password")
|
||||
|
||||
@@ -45,7 +45,6 @@ const (
|
||||
// Opts defines configuration options.
|
||||
type Opts struct {
|
||||
URL string // GitHub server url.
|
||||
Context string // Context to display in status check
|
||||
Client string // GitHub oauth client id.
|
||||
Secret string // GitHub oauth client secret.
|
||||
Scopes []string // GitHub oauth scopes
|
||||
@@ -70,7 +69,6 @@ func New(opts Opts) (remote.Remote, error) {
|
||||
r := &client{
|
||||
API: defaultAPI,
|
||||
URL: defaultURL,
|
||||
Context: opts.Context,
|
||||
Client: opts.Client,
|
||||
Secret: opts.Secret,
|
||||
Scopes: opts.Scopes,
|
||||
@@ -91,7 +89,6 @@ func New(opts Opts) (remote.Remote, error) {
|
||||
|
||||
type client struct {
|
||||
URL string
|
||||
Context string
|
||||
API string
|
||||
Client string
|
||||
Secret string
|
||||
|
||||
@@ -52,7 +52,6 @@ func Test_github(t *testing.T) {
|
||||
Password: "password",
|
||||
SkipVerify: true,
|
||||
PrivateMode: true,
|
||||
Context: "continuous-integration/test",
|
||||
})
|
||||
g.Assert(remote.(*client).URL).Equal("http://localhost:8080")
|
||||
g.Assert(remote.(*client).API).Equal("http://localhost:8080/api/v3/")
|
||||
@@ -63,7 +62,6 @@ func Test_github(t *testing.T) {
|
||||
g.Assert(remote.(*client).Secret).Equal("I1NiIsInR5")
|
||||
g.Assert(remote.(*client).SkipVerify).Equal(true)
|
||||
g.Assert(remote.(*client).PrivateMode).Equal(true)
|
||||
g.Assert(remote.(*client).Context).Equal("continuous-integration/test")
|
||||
})
|
||||
g.It("Should handle malformed url", func() {
|
||||
_, err := New(Opts{URL: "%gh&%ij"})
|
||||
|
||||
Reference in New Issue
Block a user