From bb37836600f77d4c4302bc3ae2e78ea5646993be Mon Sep 17 00:00:00 2001 From: Anbraten Date: Sat, 2 Oct 2021 10:59:34 +0200 Subject: [PATCH] Replace drone strings with woodpecker (#391) Co-authored-by: 6543 <6543@obermui.de> --- cli/exec/exec.go | 8 +-- cmd/server/flags.go | 2 +- .../frontend/yaml/compiler/option_test.go | 2 +- pipeline/frontend/yaml/constraint_test.go | 14 ++-- server/api/file.go | 2 +- server/grpc/rpc.go | 4 +- server/remote/bitbucket/bitbucket.go | 4 +- server/remote/bitbucket/convert.go | 16 ++--- .../remote/bitbucketserver/bitbucketserver.go | 4 +- server/remote/bitbucketserver/convert.go | 10 +-- server/remote/coding/coding.go | 4 +- server/remote/coding/coding_test.go | 2 +- server/remote/coding/fixtures/handler.go | 2 +- server/remote/coding/fixtures/hooks.go | 2 +- server/remote/coding/hook_test.go | 4 +- server/remote/gitea/gitea.go | 4 +- server/remote/gitea/gitea_test.go | 2 +- server/remote/gitea/helper.go | 6 +- server/remote/gitea/helper_test.go | 2 +- server/remote/github/convert.go | 24 +++---- server/remote/github/github.go | 2 +- server/remote/gogs/gogs.go | 8 +-- server/remote/gogs/gogs_test.go | 4 +- server/remote/gogs/helper.go | 6 +- server/remote/gogs/helper_test.go | 2 +- server/router/middleware/version.go | 4 +- server/shared/configFetcher_test.go | 2 +- server/shared/procBuilder.go | 2 +- server/store/datastore/builds_test.go | 8 +-- server/store/datastore/config_test.go | 8 +-- server/store/datastore/perms_test.go | 12 ++-- server/store/datastore/repos_test.go | 64 +++++++++---------- server/store/datastore/users_test.go | 10 +-- server/swagger/files/swagger.yml | 2 +- 34 files changed, 126 insertions(+), 126 deletions(-) diff --git a/cli/exec/exec.go b/cli/exec/exec.go index f1551e8e0..9397334a6 100644 --- a/cli/exec/exec.go +++ b/cli/exec/exec.go @@ -31,7 +31,7 @@ import ( var Command = cli.Command{ Name: "exec", Usage: "execute a local build", - ArgsUsage: "[path/to/.drone.yml]", + ArgsUsage: "[path/to/.woodpecker.yml]", Action: func(c *cli.Context) { if err := exec(c); err != nil { log.Fatalln(err) @@ -62,8 +62,8 @@ var Command = cli.Command{ cli.StringFlag{ EnvVar: "WOODPECKER_DOCKER_PREFIX", Name: "prefix", - Value: "drone", - Usage: "prefix containers created by drone", + Value: "woodpecker", + Usage: "prefix containers created by woodpecker", Hidden: true, }, cli.StringSliceFlag{ @@ -88,7 +88,7 @@ var Command = cli.Command{ cli.StringFlag{ EnvVar: "WOODPECKER_WORKSPACE_BASE", Name: "workspace-base", - Value: "/drone", + Value: "/woodpecker", }, cli.StringFlag{ EnvVar: "WOODPECKER_WORKSPACE_PATH", diff --git a/cmd/server/flags.go b/cmd/server/flags.go index 86b05590f..fcfabbbc7 100644 --- a/cmd/server/flags.go +++ b/cmd/server/flags.go @@ -320,7 +320,7 @@ var flags = []cli.Flag{ EnvVar: "WOODPECKER_GITEA_CONTEXT", Name: "gitea-context", Usage: "gitea status context", - Value: "continuous-integration/drone", + Value: "continuous-integration/woodpecker", }, cli.StringFlag{ EnvVar: "WOODPECKER_GITEA_GIT_USERNAME", diff --git a/pipeline/frontend/yaml/compiler/option_test.go b/pipeline/frontend/yaml/compiler/option_test.go index b169fb3e3..a2f5254e3 100644 --- a/pipeline/frontend/yaml/compiler/option_test.go +++ b/pipeline/frontend/yaml/compiler/option_test.go @@ -91,7 +91,7 @@ func TestWithResourceLimit(t *testing.T) { } func TestWithPrefix(t *testing.T) { - if New(WithPrefix("drone_")).prefix != "drone_" { + if New(WithPrefix("someprefix_")).prefix != "someprefix_" { t.Errorf("WithPrefix must set the prefix") } } diff --git a/pipeline/frontend/yaml/constraint_test.go b/pipeline/frontend/yaml/constraint_test.go index 12ce9f078..5c5a01153 100644 --- a/pipeline/frontend/yaml/constraint_test.go +++ b/pipeline/frontend/yaml/constraint_test.go @@ -410,13 +410,13 @@ func TestConstraints(t *testing.T) { // }, // repo constraint { - conf: "{ repo: drone/* }", - with: frontend.Metadata{Repo: frontend.Repo{Name: "drone/drone"}}, + conf: "{ repo: owner/* }", + with: frontend.Metadata{Repo: frontend.Repo{Name: "owner/repo"}}, want: true, }, { conf: "{ repo: octocat/* }", - with: frontend.Metadata{Repo: frontend.Repo{Name: "drone/drone"}}, + with: frontend.Metadata{Repo: frontend.Repo{Name: "owner/repo"}}, want: false, }, // ref constraint @@ -443,13 +443,13 @@ func TestConstraints(t *testing.T) { }, // instance constraint { - conf: "{ instance: drone.io }", - with: frontend.Metadata{Sys: frontend.System{Host: "drone.io"}}, + conf: "{ instance: agent.tld }", + with: frontend.Metadata{Sys: frontend.System{Host: "agent.tld"}}, want: true, }, { - conf: "{ instance: drone.io }", - with: frontend.Metadata{Sys: frontend.System{Host: "beta.drone.io"}}, + conf: "{ instance: agent.tld }", + with: frontend.Metadata{Sys: frontend.System{Host: "beta.agent.tld"}}, want: false, }, } diff --git a/server/api/file.go b/server/api/file.go index 2a803e966..9bb4aa190 100644 --- a/server/api/file.go +++ b/server/api/file.go @@ -102,7 +102,7 @@ func FileGet(c *gin.Context) { defer rc.Close() switch file.Mime { - case "application/vnd.drone.test+json": + case "application/vnd.test+json": c.Header("Content-Type", "application/json") } diff --git a/server/grpc/rpc.go b/server/grpc/rpc.go index f817cd935..b6cd9a843 100644 --- a/server/grpc/rpc.go +++ b/server/grpc/rpc.go @@ -486,12 +486,12 @@ type WoodpeckerServer struct { func NewWoodpeckerServer(remote remote.Remote, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) *WoodpeckerServer { buildTime := promauto.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "drone", + Namespace: "woodpecker", Name: "build_time", Help: "Build time.", }, []string{"repo", "branch", "status", "pipeline"}) buildCount := promauto.NewCounterVec(prometheus.CounterOpts{ - Namespace: "drone", + Namespace: "woodpecker", Name: "build_count", Help: "Build count.", }, []string{"repo", "branch", "status", "pipeline"}) diff --git a/server/remote/bitbucket/bitbucket.go b/server/remote/bitbucket/bitbucket.go index 7929550ee..07bacbe19 100644 --- a/server/remote/bitbucket/bitbucket.go +++ b/server/remote/bitbucket/bitbucket.go @@ -69,7 +69,7 @@ func (c *config) Login(ctx context.Context, w http.ResponseWriter, req *http.Req // get the OAuth code code := req.FormValue("code") if len(code) == 0 { - http.Redirect(w, req, config.AuthCodeURL("drone"), http.StatusSeeOther) + http.Redirect(w, req, config.AuthCodeURL("woodpecker"), http.StatusSeeOther) return nil, nil } @@ -218,7 +218,7 @@ func (c *config) Status(ctx context.Context, u *model.User, r *model.Repo, b *mo status := internal.BuildStatus{ State: convertStatus(b.Status), Desc: convertDesc(b.Status), - Key: "Drone", + Key: "Woodpecker", Url: link, } return c.newClient(ctx, u).CreateStatus(r.Owner, r.Name, b.Commit, &status) diff --git a/server/remote/bitbucket/convert.go b/server/remote/bitbucket/convert.go index 11b2d27b7..50139ebd7 100644 --- a/server/remote/bitbucket/convert.go +++ b/server/remote/bitbucket/convert.go @@ -41,7 +41,7 @@ const ( descError = "oops, something went wrong" ) -// convertStatus is a helper function used to convert a Drone status to a +// convertStatus is a helper function used to convert a Woodpecker status to a // Bitbucket commit status. func convertStatus(status string) string { switch status { @@ -54,7 +54,7 @@ func convertStatus(status string) string { } } -// convertDesc is a helper function used to convert a Drone status to a +// convertDesc is a helper function used to convert a Woodpecker status to a // Bitbucket status description. func convertDesc(status string) string { switch status { @@ -74,7 +74,7 @@ func convertDesc(status string) string { } // convertRepo is a helper function used to convert a Bitbucket repository -// structure to the common Drone repository structure. +// structure to the common Woodpecker repository structure. func convertRepo(from *internal.Repo) *model.Repo { repo := model.Repo{ Clone: cloneLink(from), @@ -125,7 +125,7 @@ func cloneLink(repo *internal.Repo) string { } // convertUser is a helper function used to convert a Bitbucket user account -// structure to the Drone User structure. +// structure to the Woodpecker User structure. func convertUser(from *internal.Account, token *oauth2.Token) *model.User { return &model.User{ Login: from.Login, @@ -137,7 +137,7 @@ func convertUser(from *internal.Account, token *oauth2.Token) *model.User { } // convertTeamList is a helper function used to convert a Bitbucket team list -// structure to the Drone Team structure. +// structure to the Woodpecker Team structure. func convertTeamList(from []*internal.Account) []*model.Team { var teams []*model.Team for _, team := range from { @@ -147,7 +147,7 @@ func convertTeamList(from []*internal.Account) []*model.Team { } // convertTeam is a helper function used to convert a Bitbucket team account -// structure to the Drone Team structure. +// structure to the Woodpecker Team structure. func convertTeam(from *internal.Account) *model.Team { return &model.Team{ Login: from.Login, @@ -156,7 +156,7 @@ func convertTeam(from *internal.Account) *model.Team { } // convertPullHook is a helper function used to convert a Bitbucket pull request -// hook to the Drone build struct holding commit information. +// hook to the Woodpecker build struct holding commit information. func convertPullHook(from *internal.PullRequestHook) *model.Build { return &model.Build{ Event: model.EventPull, @@ -178,7 +178,7 @@ func convertPullHook(from *internal.PullRequestHook) *model.Build { } // convertPushHook is a helper function used to convert a Bitbucket push -// hook to the Drone build struct holding commit information. +// hook to the Woodpecker build struct holding commit information. func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Build { build := &model.Build{ Commit: change.New.Target.Hash, diff --git a/server/remote/bitbucketserver/bitbucketserver.go b/server/remote/bitbucketserver/bitbucketserver.go index b1e08ec52..0d904104d 100644 --- a/server/remote/bitbucketserver/bitbucketserver.go +++ b/server/remote/bitbucketserver/bitbucketserver.go @@ -189,8 +189,8 @@ func (c *Config) Status(ctx context.Context, u *model.User, r *model.Repo, b *mo status := internal.BuildStatus{ State: convertStatus(b.Status), Desc: convertDesc(b.Status), - Name: fmt.Sprintf("Drone #%d - %s", b.Number, b.Branch), - Key: "Drone", + Name: fmt.Sprintf("Woodpecker #%d - %s", b.Number, b.Branch), + Key: "Woodpecker", Url: link, } diff --git a/server/remote/bitbucketserver/convert.go b/server/remote/bitbucketserver/convert.go index e0020ab2c..6a238d5fb 100644 --- a/server/remote/bitbucketserver/convert.go +++ b/server/remote/bitbucketserver/convert.go @@ -40,7 +40,7 @@ const ( descError = "oops, something went wrong" ) -// convertStatus is a helper function used to convert a Drone status to a +// convertStatus is a helper function used to convert a Woodpecker status to a // Bitbucket commit status. func convertStatus(status string) string { switch status { @@ -53,7 +53,7 @@ func convertStatus(status string) string { } } -// convertDesc is a helper function used to convert a Drone status to a +// convertDesc is a helper function used to convert a Woodpecker status to a // Bitbucket status description. func convertDesc(status string) string { switch status { @@ -69,7 +69,7 @@ func convertDesc(status string) string { } // convertRepo is a helper function used to convert a Bitbucket server repository -// structure to the common Drone repository structure. +// structure to the common Woodpecker repository structure. func convertRepo(from *internal.Repo) *model.Repo { repo := model.Repo{ @@ -101,7 +101,7 @@ func convertRepo(from *internal.Repo) *model.Repo { } // convertPushHook is a helper function used to convert a Bitbucket push -// hook to the Drone build struct holding commit information. +// hook to the Woodpecker build struct holding commit information. func convertPushHook(hook *internal.PostHook, baseURL string) *model.Build { branch := strings.TrimPrefix( strings.TrimPrefix( @@ -138,7 +138,7 @@ func convertPushHook(hook *internal.PostHook, baseURL string) *model.Build { } // convertUser is a helper function used to convert a Bitbucket user account -// structure to the Drone User structure. +// structure to the Woodpecker User structure. func convertUser(from *internal.User, token *oauth.AccessToken) *model.User { return &model.User{ Login: from.Slug, diff --git a/server/remote/coding/coding.go b/server/remote/coding/coding.go index 67e9db318..559cc7d11 100644 --- a/server/remote/coding/coding.go +++ b/server/remote/coding/coding.go @@ -93,7 +93,7 @@ func (c *Coding) Login(ctx context.Context, res http.ResponseWriter, req *http.R // get the OAuth code code := req.FormValue("code") if len(code) == 0 { - http.Redirect(res, req, config.AuthCodeURL("drone"), http.StatusSeeOther) + http.Redirect(res, req, config.AuthCodeURL("woodpecker"), http.StatusSeeOther) return nil, nil } @@ -331,7 +331,7 @@ func (c *Coding) newClientToken(ctx context.Context, token string) *internal.Cli }, }, } - return internal.NewClient(ctx, c.URL, "/api", token, "drone", client) + return internal.NewClient(ctx, c.URL, "/api", token, "woodpecker", client) } func (c *Coding) resourceLink(resourcePath string) string { diff --git a/server/remote/coding/coding_test.go b/server/remote/coding/coding_test.go index 380896dc3..19c0ecb83 100644 --- a/server/remote/coding/coding_test.go +++ b/server/remote/coding/coding_test.go @@ -164,7 +164,7 @@ func Test_coding(t *testing.T) { g.Describe("When downloading a file", func() { g.It("Should return file for specified build", func() { - data, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".drone.yml") + data, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".woodpecker.yml") g.Assert(err == nil).IsTrue() g.Assert(string(data)).Equal("pipeline:\n test:\n image: golang:1.6\n commands:\n - go test\n") }) diff --git a/server/remote/coding/fixtures/handler.go b/server/remote/coding/fixtures/handler.go index a0e7ce8b8..90028e51f 100644 --- a/server/remote/coding/fixtures/handler.go +++ b/server/remote/coding/fixtures/handler.go @@ -108,7 +108,7 @@ func getProjects(c *gin.Context) { func getFile(c *gin.Context) { c.Header("Content-Type", "application/json;charset=UTF-8") switch fmt.Sprintf("%s/%s/%s/%s", c.Param("gk"), c.Param("prj"), c.Param("ref"), c.Param("path")) { - case "demo1/test1/master/.drone.yml", "demo1/test1/4504a072cc/.drone.yml": + case "demo1/test1/master/.woodpecker.yml", "demo1/test1/4504a072cc/.woodpecker.yml": c.String(200, fakeFilePayload) default: c.String(200, fileNotFoundPayload) diff --git a/server/remote/coding/fixtures/hooks.go b/server/remote/coding/fixtures/hooks.go index 6a7a63ff2..af422e37f 100644 --- a/server/remote/coding/fixtures/hooks.go +++ b/server/remote/coding/fixtures/hooks.go @@ -25,7 +25,7 @@ const PushHook = ` "email": "demo1@gmail.com" }, "web_url": "https://coding.net/u/demo1/p/test1/git/commit/5b9912a6ff272e9c93a4c44c278fe9b359ed1ab4", - "short_message": "new file .drone.yml\n", + "short_message": "new file .woodpecker.yml\n", "sha": "5b9912a6ff272e9c93a4c44c278fe9b359ed1ab4" } ], diff --git a/server/remote/coding/hook_test.go b/server/remote/coding/hook_test.go index 2d61f8293..ce540e3c9 100644 --- a/server/remote/coding/hook_test.go +++ b/server/remote/coding/hook_test.go @@ -55,7 +55,7 @@ func Test_hook(t *testing.T) { Ref: "refs/heads/master", Link: "https://coding.net/u/demo1/p/test1/git/commit/5b9912a6ff272e9c93a4c44c278fe9b359ed1ab4", Branch: "master", - Message: "new file .drone.yml\n", + Message: "new file .woodpecker.yml\n", Email: "demo1@gmail.com", Avatar: "/static/fruit_avatar/Fruit-20.png", Author: "demo1", @@ -122,7 +122,7 @@ func Test_hook(t *testing.T) { Ref: "refs/heads/master", Link: "https://coding.net/u/demo1/p/test1/git/commit/5b9912a6ff272e9c93a4c44c278fe9b359ed1ab4", Branch: "master", - Message: "new file .drone.yml\n", + Message: "new file .woodpecker.yml\n", Email: "demo1@gmail.com", Avatar: "/static/fruit_avatar/Fruit-20.png", Author: "demo1", diff --git a/server/remote/gitea/gitea.go b/server/remote/gitea/gitea.go index 227a32b0d..a5cdf5408 100644 --- a/server/remote/gitea/gitea.go +++ b/server/remote/gitea/gitea.go @@ -114,7 +114,7 @@ func (c *Gitea) Login(ctx context.Context, w http.ResponseWriter, req *http.Requ // get the OAuth code code := req.FormValue("code") if len(code) == 0 { - http.Redirect(w, req, config.AuthCodeURL("drone"), http.StatusSeeOther) + http.Redirect(w, req, config.AuthCodeURL("woodpecker"), http.StatusSeeOther) return nil, nil } @@ -451,7 +451,7 @@ const ( DescDeclined = "the build was rejected" ) -// getStatus is a helper function that converts a Drone +// getStatus is a helper function that converts a Woodpecker // status to a Gitea status. func getStatus(status string) gitea.StatusState { switch status { diff --git a/server/remote/gitea/gitea_test.go b/server/remote/gitea/gitea_test.go index f6e9ef063..47e111bf0 100644 --- a/server/remote/gitea/gitea_test.go +++ b/server/remote/gitea/gitea_test.go @@ -145,7 +145,7 @@ func Test_gitea(t *testing.T) { }) g.It("Should return a repository file", func() { - raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".drone.yml") + raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".woodpecker.yml") g.Assert(err == nil).IsTrue() g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") }) diff --git a/server/remote/gitea/helper.go b/server/remote/gitea/helper.go index 6d04c2c0a..d43b69e29 100644 --- a/server/remote/gitea/helper.go +++ b/server/remote/gitea/helper.go @@ -26,7 +26,7 @@ import ( "github.com/woodpecker-ci/woodpecker/server/model" ) -// helper function that converts a Gitea repository to a Drone repository. +// helper function that converts a Gitea repository to a Woodpecker repository. func toRepo(from *gitea.Repository, privateMode bool) *model.Repo { name := strings.Split(from.FullName, "/")[1] avatar := expandAvatar( @@ -50,7 +50,7 @@ func toRepo(from *gitea.Repository, privateMode bool) *model.Repo { } } -// helper function that converts a Gitea permission to a Drone permission. +// helper function that converts a Gitea permission to a Woodpecker permission. func toPerm(from *gitea.Permission) *model.Perm { return &model.Perm{ Pull: from.Pull, @@ -59,7 +59,7 @@ func toPerm(from *gitea.Permission) *model.Perm { } } -// helper function that converts a Gitea team to a Drone team. +// helper function that converts a Gitea team to a Woodpecker team. func toTeam(from *gitea.Organization, link string) *model.Team { return &model.Team{ Login: from.UserName, diff --git a/server/remote/gitea/helper_test.go b/server/remote/gitea/helper_test.go index 8cfc045c4..4e67901cb 100644 --- a/server/remote/gitea/helper_test.go +++ b/server/remote/gitea/helper_test.go @@ -186,7 +186,7 @@ func Test_parse(t *testing.T) { g.It("Should return a Team struct from a Gitea Org", func() { from := &gitea.Organization{ - UserName: "drone", + UserName: "woodpecker", AvatarURL: "/avatars/1", } diff --git a/server/remote/github/convert.go b/server/remote/github/convert.go index a89fd7686..aa0cd17b8 100644 --- a/server/remote/github/convert.go +++ b/server/remote/github/convert.go @@ -47,7 +47,7 @@ const ( refspec = "%s:%s" ) -// convertStatus is a helper function used to convert a Drone status to a +// convertStatus is a helper function used to convert a Woodpecker status to a // GitHub commit status. func convertStatus(status string) string { switch status { @@ -62,7 +62,7 @@ func convertStatus(status string) string { } } -// convertDesc is a helper function used to convert a Drone status to a +// convertDesc is a helper function used to convert a Woodpecker status to a // GitHub status description. func convertDesc(status string) string { switch status { @@ -82,7 +82,7 @@ func convertDesc(status string) string { } // convertRepo is a helper function used to convert a GitHub repository -// structure to the common Drone repository structure. +// structure to the common Woodpecker repository structure. func convertRepo(from *github.Repository, private bool) *model.Repo { repo := &model.Repo{ Owner: *from.Owner.Login, @@ -106,7 +106,7 @@ func convertRepo(from *github.Repository, private bool) *model.Repo { } // convertPerm is a helper function used to convert a GitHub repository -// permissions to the common Drone permissions structure. +// permissions to the common Woodpecker permissions structure. func convertPerm(from *github.Repository) *model.Perm { return &model.Perm{ Admin: from.Permissions["admin"], @@ -116,7 +116,7 @@ func convertPerm(from *github.Repository) *model.Perm { } // convertTeamPerm is a helper function used to convert a GitHub organization -// permissions to the common Drone permissions structure. +// permissions to the common Woodpecker permissions structure. func convertTeamPerm(from *github.Membership) *model.Perm { admin := false if *from.Role == "admin" { @@ -128,7 +128,7 @@ func convertTeamPerm(from *github.Membership) *model.Perm { } // convertRepoList is a helper function used to convert a GitHub repository -// list to the common Drone repository structure. +// list to the common Woodpecker repository structure. func convertRepoList(from []*github.Repository, private bool) []*model.Repo { var repos []*model.Repo for _, repo := range from { @@ -138,7 +138,7 @@ func convertRepoList(from []*github.Repository, private bool) []*model.Repo { } // convertTeamList is a helper function used to convert a GitHub team list to -// the common Drone repository structure. +// the common Woodpecker repository structure. func convertTeamList(from []*github.Organization) []*model.Team { var teams []*model.Team for _, team := range from { @@ -148,7 +148,7 @@ func convertTeamList(from []*github.Organization) []*model.Team { } // convertTeam is a helper function used to convert a GitHub team structure -// to the common Drone repository structure. +// to the common Woodpecker repository structure. func convertTeam(from *github.Organization) *model.Team { return &model.Team{ Login: *from.Login, @@ -157,7 +157,7 @@ func convertTeam(from *github.Organization) *model.Team { } // convertRepoHook is a helper function used to extract the Repository details -// from a webhook and convert to the common Drone repository structure. +// from a webhook and convert to the common Woodpecker repository structure. func convertRepoHook(from *webhook) *model.Repo { repo := &model.Repo{ Owner: from.Repo.Owner.Login, @@ -182,7 +182,7 @@ func convertRepoHook(from *webhook) *model.Repo { } // convertPushHook is a helper function used to extract the Build details -// from a push webhook and convert to the common Drone Build structure. +// from a push webhook and convert to the common Woodpecker Build structure. func convertPushHook(from *webhook) *model.Build { files := getChangedFilesFromWebhook(from) build := &model.Build{ @@ -219,7 +219,7 @@ func convertPushHook(from *webhook) *model.Build { } // convertPushHook is a helper function used to extract the Build details -// from a deploy webhook and convert to the common Drone Build structure. +// from a deploy webhook and convert to the common Woodpecker Build structure. func convertDeployHook(from *webhook) *model.Build { build := &model.Build{ Event: model.EventDeploy, @@ -249,7 +249,7 @@ func convertDeployHook(from *webhook) *model.Build { } // convertPullHook is a helper function used to extract the Build details -// from a pull request webhook and convert to the common Drone Build structure. +// from a pull request webhook and convert to the common Woodpecker Build structure. func convertPullHook(from *webhook, merge bool) *model.Build { build := &model.Build{ Event: model.EventPull, diff --git a/server/remote/github/github.go b/server/remote/github/github.go index 92a9236e4..38376f489 100644 --- a/server/remote/github/github.go +++ b/server/remote/github/github.go @@ -119,7 +119,7 @@ func (c *client) Login(ctx context.Context, res http.ResponseWriter, req *http.R // TODO(bradrydzewski) we really should be using a random value here and // storing in a cookie for verification in the next stage of the workflow. - http.Redirect(res, req, config.AuthCodeURL("drone"), http.StatusSeeOther) + http.Redirect(res, req, config.AuthCodeURL("woodpecker"), http.StatusSeeOther) return nil, nil } diff --git a/server/remote/gogs/gogs.go b/server/remote/gogs/gogs.go index c772f9d3b..a4e6d74ce 100644 --- a/server/remote/gogs/gogs.go +++ b/server/remote/gogs/gogs.go @@ -83,24 +83,24 @@ func (c *client) Login(ctx context.Context, res http.ResponseWriter, req *http.R client := c.newClient() - // try to fetch drone token if it exists + // try to fetch woodpecker token if it exists var accessToken string tokens, err := client.ListAccessTokens(username, password) if err == nil { for _, token := range tokens { - if token.Name == "drone" { + if token.Name == "woodpecker" { accessToken = token.Sha1 break } } } - // if drone token not found, create it + // if woodpecker token not found, create it if accessToken == "" { token, terr := client.CreateAccessToken( username, password, - gogs.CreateAccessTokenOption{Name: "drone"}, + gogs.CreateAccessTokenOption{Name: "woodpecker"}, ) if terr != nil { return nil, terr diff --git a/server/remote/gogs/gogs_test.go b/server/remote/gogs/gogs_test.go index 298b466df..bd029a4b2 100644 --- a/server/remote/gogs/gogs_test.go +++ b/server/remote/gogs/gogs_test.go @@ -139,13 +139,13 @@ func Test_gogs(t *testing.T) { }) g.It("Should return a repository file", func() { - raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".drone.yml") + raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuild, ".woodpecker.yml") g.Assert(err == nil).IsTrue() g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") }) g.It("Should return a repository file from a ref", func() { - raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuildWithRef, ".drone.yml") + raw, err := c.File(ctx, fakeUser, fakeRepo, fakeBuildWithRef, ".woodpecker.yml") g.Assert(err == nil).IsTrue() g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") }) diff --git a/server/remote/gogs/helper.go b/server/remote/gogs/helper.go index 9e60d90f6..e06d550c4 100644 --- a/server/remote/gogs/helper.go +++ b/server/remote/gogs/helper.go @@ -26,7 +26,7 @@ import ( "github.com/woodpecker-ci/woodpecker/server/model" ) -// helper function that converts a Gogs repository to a Drone repository. +// helper function that converts a Gogs repository to a Woodpecker repository. func toRepo(from *gogs.Repository, privateMode bool) *model.Repo { name := strings.Split(from.FullName, "/")[1] avatar := expandAvatar( @@ -50,7 +50,7 @@ func toRepo(from *gogs.Repository, privateMode bool) *model.Repo { } } -// helper function that converts a Gogs permission to a Drone permission. +// helper function that converts a Gogs permission to a Woodpecker permission. func toPerm(from gogs.Permission) *model.Perm { return &model.Perm{ Pull: from.Pull, @@ -59,7 +59,7 @@ func toPerm(from gogs.Permission) *model.Perm { } } -// helper function that converts a Gogs team to a Drone team. +// helper function that converts a Gogs team to a Woodpecker team. func toTeam(from *gogs.Organization, link string) *model.Team { return &model.Team{ Login: from.UserName, diff --git a/server/remote/gogs/helper_test.go b/server/remote/gogs/helper_test.go index 884167adf..fab96bba6 100644 --- a/server/remote/gogs/helper_test.go +++ b/server/remote/gogs/helper_test.go @@ -159,7 +159,7 @@ func Test_parse(t *testing.T) { g.It("Should return a Team struct from a Gogs Org", func() { from := &gogs.Organization{ - UserName: "drone", + UserName: "woodpecker", AvatarUrl: "/avatars/1", } diff --git a/server/router/middleware/version.go b/server/router/middleware/version.go index 5fa390541..c68b61650 100644 --- a/server/router/middleware/version.go +++ b/server/router/middleware/version.go @@ -19,8 +19,8 @@ import ( "github.com/woodpecker-ci/woodpecker/version" ) -// Version is a middleware function that appends the Drone version information +// Version is a middleware function that appends the Woodpecker version information // to the HTTP response. This is intended for debugging and troubleshooting. func Version(c *gin.Context) { - c.Header("X-DRONE-VERSION", version.String()) + c.Header("X-WOODPECKER-VERSION", version.String()) } diff --git a/server/shared/configFetcher_test.go b/server/shared/configFetcher_test.go index d93448fb9..95cead727 100644 --- a/server/shared/configFetcher_test.go +++ b/server/shared/configFetcher_test.go @@ -212,7 +212,7 @@ func TestFetch(t *testing.T) { for _, tt := range testTable { t.Run(tt.name, func(t *testing.T) { - repo := &model.Repo{Owner: "laszlocph", Name: "drone-multipipeline", Config: tt.repoConfig} + repo := &model.Repo{Owner: "laszlocph", Name: "multipipeline", Config: tt.repoConfig} r := new(mocks.Remote) dirs := map[string][]*remote.FileMeta{} diff --git a/server/shared/procBuilder.go b/server/shared/procBuilder.go index 5f56e2be5..09d1dedbd 100644 --- a/server/shared/procBuilder.go +++ b/server/shared/procBuilder.go @@ -352,7 +352,7 @@ func metadataFromStruct(repo *model.Repo, build, last *model.Build, proc *model. Matrix: proc.Environ, }, Sys: frontend.System{ - Name: "drone", + Name: "woodpecker", Link: link, Host: host, Arch: "linux/amd64", diff --git a/server/store/datastore/builds_test.go b/server/store/datastore/builds_test.go index a3e5c786f..3c26b7fed 100644 --- a/server/store/datastore/builds_test.go +++ b/server/store/datastore/builds_test.go @@ -25,9 +25,9 @@ import ( func TestBuilds(t *testing.T) { repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s := newTest() @@ -287,9 +287,9 @@ func TestBuildIncrement(t *testing.T) { repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } if err := s.CreateRepo(repo); err != nil { t.Error(err) diff --git a/server/store/datastore/config_test.go b/server/store/datastore/config_test.go index a7c2c7a23..af1f8ec4a 100644 --- a/server/store/datastore/config_test.go +++ b/server/store/datastore/config_test.go @@ -37,9 +37,9 @@ func TestConfig(t *testing.T) { repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } if err := s.CreateRepo(repo); err != nil { t.Errorf("Unexpected error: insert repo: %s", err) @@ -120,9 +120,9 @@ func TestConfigApproved(t *testing.T) { repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } if err := s.CreateRepo(repo); err != nil { t.Errorf("Unexpected error: insert repo: %s", err) diff --git a/server/store/datastore/perms_test.go b/server/store/datastore/perms_test.go index 80204d4d7..cdf9f6b4f 100644 --- a/server/store/datastore/perms_test.go +++ b/server/store/datastore/perms_test.go @@ -31,9 +31,9 @@ func TestPermFind(t *testing.T) { user := &model.User{ID: 1} repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(repo) @@ -79,9 +79,9 @@ func TestPermUpsert(t *testing.T) { user := &model.User{ID: 1} repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(repo) @@ -162,9 +162,9 @@ func TestPermDelete(t *testing.T) { user := &model.User{ID: 1} repo := &model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(repo) diff --git a/server/store/datastore/repos_test.go b/server/store/datastore/repos_test.go index 0bae25386..3c074c23a 100644 --- a/server/store/datastore/repos_test.go +++ b/server/store/datastore/repos_test.go @@ -40,9 +40,9 @@ func TestRepos(t *testing.T) { g.It("Should Set a Repo", func() { repo := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } err1 := s.CreateRepo(&repo) err2 := s.UpdateRepo(&repo) @@ -57,9 +57,9 @@ func TestRepos(t *testing.T) { g.It("Should Add a Repo", func() { repo := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } err := s.CreateRepo(&repo) g.Assert(err == nil).IsTrue() @@ -69,9 +69,9 @@ func TestRepos(t *testing.T) { g.It("Should Get a Repo by ID", func() { repo := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(&repo) getrepo, err := s.GetRepo(repo.ID) @@ -85,9 +85,9 @@ func TestRepos(t *testing.T) { g.It("Should Get a Repo by Name", func() { repo := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(&repo) getrepo, err := s.GetRepoName(repo.FullName) @@ -101,15 +101,15 @@ func TestRepos(t *testing.T) { g.It("Should Enforce Unique Repo Name", func() { repo1 := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } repo2 := model.Repo{ UserID: 2, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } err1 := s.CreateRepo(&repo1) err2 := s.CreateRepo(&repo2) @@ -141,13 +141,13 @@ func TestRepoList(t *testing.T) { repo1 := &model.Repo{ Owner: "bradrydzewski", - Name: "drone", - FullName: "bradrydzewski/drone", + Name: "test", + FullName: "bradrydzewski/test", } repo2 := &model.Repo{ - Owner: "drone", - Name: "drone", - FullName: "drone/drone", + Owner: "test", + Name: "test", + FullName: "test/test", } repo3 := &model.Repo{ Owner: "octocat", @@ -197,14 +197,14 @@ func TestRepoListLatest(t *testing.T) { repo1 := &model.Repo{ Owner: "bradrydzewski", - Name: "drone", - FullName: "bradrydzewski/drone", + Name: "test", + FullName: "bradrydzewski/test", IsActive: true, } repo2 := &model.Repo{ - Owner: "drone", - Name: "drone", - FullName: "drone/drone", + Owner: "test", + Name: "test", + FullName: "test/test", IsActive: true, } repo3 := &model.Repo{ @@ -276,20 +276,20 @@ func TestRepoCount(t *testing.T) { repo1 := &model.Repo{ Owner: "bradrydzewski", - Name: "drone", - FullName: "bradrydzewski/drone", + Name: "test", + FullName: "bradrydzewski/test", IsActive: true, } repo2 := &model.Repo{ - Owner: "drone", - Name: "drone", - FullName: "drone/drone", + Owner: "test", + Name: "test", + FullName: "test/test", IsActive: true, } repo3 := &model.Repo{ - Owner: "drone", - Name: "drone-ui", - FullName: "drone/drone-ui", + Owner: "test", + Name: "test-ui", + FullName: "test/test-ui", IsActive: false, } s.CreateRepo(repo1) @@ -373,9 +373,9 @@ func TestRepoCrud(t *testing.T) { repo := model.Repo{ UserID: 1, - FullName: "bradrydzewski/drone", + FullName: "bradrydzewski/test", Owner: "bradrydzewski", - Name: "drone", + Name: "test", } s.CreateRepo(&repo) _, err1 := s.GetRepo(repo.ID) diff --git a/server/store/datastore/users_test.go b/server/store/datastore/users_test.go index c0a839865..7e860b437 100644 --- a/server/store/datastore/users_test.go +++ b/server/store/datastore/users_test.go @@ -189,14 +189,14 @@ func TestUsers(t *testing.T) { repo1 := &model.Repo{ Owner: "bradrydzewski", - Name: "drone", - FullName: "bradrydzewski/drone", + Name: "test", + FullName: "bradrydzewski/test", IsActive: true, } repo2 := &model.Repo{ - Owner: "drone", - Name: "drone", - FullName: "drone/drone", + Owner: "test", + Name: "test", + FullName: "test/test", IsActive: true, } repo3 := &model.Repo{ diff --git a/server/swagger/files/swagger.yml b/server/swagger/files/swagger.yml index 3394afb32..08c01adc0 100644 --- a/server/swagger/files/swagger.yml +++ b/server/swagger/files/swagger.yml @@ -1,7 +1,7 @@ swagger: "2.0" info: version: 1.0.0 - title: Drone API + title: Woodpecker API license: name: Creative Commons 4.0 International url: "http://creativecommons.org/licenses/by/4.0/"