From b05c5f878e0fd154062b7082e68650d7646ad5b7 Mon Sep 17 00:00:00 2001 From: Jacob McCann Date: Sat, 17 Dec 2016 07:53:38 -0600 Subject: [PATCH 1/9] Add pprof endpoints --- router/router.go | 15 +++++++++++ server/debug.go | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 server/debug.go diff --git a/router/router.go b/router/router.go index 55a669495..f5def78db 100644 --- a/router/router.go +++ b/router/router.go @@ -153,6 +153,21 @@ func Load(middleware ...gin.HandlerFunc) http.Handler { agents.GET("", server.GetAgents) } + debug := e.Group("/api/debug") + { + debug.Use(session.MustAdmin()) + debug.GET("/pprof/", server.IndexHandler()) + debug.GET("/pprof/heap", server.HeapHandler()) + debug.GET("/pprof/goroutine", server.GoroutineHandler()) + debug.GET("/pprof/block", server.BlockHandler()) + debug.GET("/pprof/threadcreate", server.ThreadCreateHandler()) + debug.GET("/pprof/cmdline", server.CmdlineHandler()) + debug.GET("/pprof/profile", server.ProfileHandler()) + debug.GET("/pprof/symbol", server.SymbolHandler()) + debug.POST("/pprof/symbol", server.SymbolHandler()) + debug.GET("/pprof/trace", server.TraceHandler()) + } + // DELETE THESE // gitlab := e.Group("/gitlab/:owner/:name") // { diff --git a/server/debug.go b/server/debug.go new file mode 100644 index 000000000..8ecb4bd56 --- /dev/null +++ b/server/debug.go @@ -0,0 +1,70 @@ +package server + +import ( + "net/http/pprof" + + "github.com/gin-gonic/gin" +) + +// IndexHandler will pass the call from /debug/pprof to pprof +func IndexHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Index(c.Writer, c.Request) + } +} + +// HeapHandler will pass the call from /debug/pprof/heap to pprof +func HeapHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Handler("heap").ServeHTTP(c.Writer, c.Request) + } +} + +// GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof +func GoroutineHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Handler("goroutine").ServeHTTP(c.Writer, c.Request) + } +} + +// BlockHandler will pass the call from /debug/pprof/block to pprof +func BlockHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Handler("block").ServeHTTP(c.Writer, c.Request) + } +} + +// ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof +func ThreadCreateHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Handler("threadcreate").ServeHTTP(c.Writer, c.Request) + } +} + +// CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof +func CmdlineHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Cmdline(c.Writer, c.Request) + } +} + +// ProfileHandler will pass the call from /debug/pprof/profile to pprof +func ProfileHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Profile(c.Writer, c.Request) + } +} + +// SymbolHandler will pass the call from /debug/pprof/symbol to pprof +func SymbolHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Symbol(c.Writer, c.Request) + } +} + +// TraceHandler will pass the call from /debug/pprof/trace to pprof +func TraceHandler() gin.HandlerFunc { + return func(c *gin.Context) { + pprof.Trace(c.Writer, c.Request) + } +} From 3884e589a974c70a22210f133ab00bbf0fb89bf7 Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Thu, 22 Dec 2016 09:54:54 +0100 Subject: [PATCH 2/9] Remove /refs/tags or /refs/heads from Gogs remote File() when using build.Ref --- remote/gogs/fixtures/handler.go | 13 +++++++------ remote/gogs/gogs.go | 7 +++++++ remote/gogs/gogs_test.go | 10 ++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/remote/gogs/fixtures/handler.go b/remote/gogs/fixtures/handler.go index 26300644c..ebc81702d 100644 --- a/remote/gogs/fixtures/handler.go +++ b/remote/gogs/fixtures/handler.go @@ -30,12 +30,13 @@ func getRepo(c *gin.Context) { } func getRepoFile(c *gin.Context) { - switch c.Param("file") { - case "file_not_found": - c.String(404, "") - default: - c.String(200, repoFilePayload) - } + if c.Param("file") == "file_not_found" { + c.String(404, "") + } + if c.Param("commit") == "v1.0.0" || c.Param("commit") == "9ecad50" { + c.String(200, repoFilePayload) + } + c.String(404, "") } func createRepoHook(c *gin.Context) { diff --git a/remote/gogs/gogs.go b/remote/gogs/gogs.go index 666101036..88be743c9 100644 --- a/remote/gogs/gogs.go +++ b/remote/gogs/gogs.go @@ -6,6 +6,7 @@ import ( "net" "net/http" "net/url" + "strings" "github.com/drone/drone/model" "github.com/drone/drone/remote" @@ -177,6 +178,12 @@ func (c *client) File(u *model.User, r *model.Repo, b *model.Build, f string) ([ buildRef := b.Commit if buildRef == "" { buildRef = b.Ref + + // Remove refs/tags or refs/heads, Gogs needs a short ref + refPath := strings.SplitAfterN(b.Ref, "/", 3) + if len(refPath) > 0 { + buildRef = refPath[len(refPath)-1] + } } cfg, err := client.GetFile(r.Owner, r.Name, buildRef, f) return cfg, err diff --git a/remote/gogs/gogs_test.go b/remote/gogs/gogs_test.go index 1d88d1302..70bd9a78b 100644 --- a/remote/gogs/gogs_test.go +++ b/remote/gogs/gogs_test.go @@ -128,6 +128,12 @@ func Test_gogs(t *testing.T) { g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") }) + g.It("Should return a repository file from a ref", func() { + raw, err := c.File(fakeUser, fakeRepo, fakeBuildWithRef, ".drone.yml") + g.Assert(err == nil).IsTrue() + g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") + }) + g.Describe("Given an authentication request", func() { g.It("Should redirect to login form") g.It("Should create an access token") @@ -178,4 +184,8 @@ var ( fakeBuild = &model.Build{ Commit: "9ecad50", } + + fakeBuildWithRef = &model.Build{ + Ref: "refs/tags/v1.0.0", + } ) From 5c2938d9700402f37bd927df040d1e28dfc0fe3c Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Thu, 22 Dec 2016 11:54:53 +0100 Subject: [PATCH 3/9] Format code --- remote/gogs/fixtures/handler.go | 14 +++++++------- remote/gogs/gogs.go | 2 +- remote/gogs/gogs_test.go | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/remote/gogs/fixtures/handler.go b/remote/gogs/fixtures/handler.go index ebc81702d..5904a1dd3 100644 --- a/remote/gogs/fixtures/handler.go +++ b/remote/gogs/fixtures/handler.go @@ -30,13 +30,13 @@ func getRepo(c *gin.Context) { } func getRepoFile(c *gin.Context) { - if c.Param("file") == "file_not_found" { - c.String(404, "") - } - if c.Param("commit") == "v1.0.0" || c.Param("commit") == "9ecad50" { - c.String(200, repoFilePayload) - } - c.String(404, "") + if c.Param("file") == "file_not_found" { + c.String(404, "") + } + if c.Param("commit") == "v1.0.0" || c.Param("commit") == "9ecad50" { + c.String(200, repoFilePayload) + } + c.String(404, "") } func createRepoHook(c *gin.Context) { diff --git a/remote/gogs/gogs.go b/remote/gogs/gogs.go index 88be743c9..cbf2e81f9 100644 --- a/remote/gogs/gogs.go +++ b/remote/gogs/gogs.go @@ -6,7 +6,7 @@ import ( "net" "net/http" "net/url" - "strings" + "strings" "github.com/drone/drone/model" "github.com/drone/drone/remote" diff --git a/remote/gogs/gogs_test.go b/remote/gogs/gogs_test.go index 70bd9a78b..bfd8728c9 100644 --- a/remote/gogs/gogs_test.go +++ b/remote/gogs/gogs_test.go @@ -128,11 +128,11 @@ func Test_gogs(t *testing.T) { g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") }) - g.It("Should return a repository file from a ref", func() { - raw, err := c.File(fakeUser, fakeRepo, fakeBuildWithRef, ".drone.yml") + g.It("Should return a repository file from a ref", func() { + raw, err := c.File(fakeUser, fakeRepo, fakeBuildWithRef, ".drone.yml") g.Assert(err == nil).IsTrue() g.Assert(string(raw)).Equal("{ platform: linux/amd64 }") - }) + }) g.Describe("Given an authentication request", func() { g.It("Should redirect to login form") @@ -185,7 +185,7 @@ var ( Commit: "9ecad50", } - fakeBuildWithRef = &model.Build{ - Ref: "refs/tags/v1.0.0", - } + fakeBuildWithRef = &model.Build{ + Ref: "refs/tags/v1.0.0", + } ) From c2703ff89c1b4c99041bacc2c93ab13f3ab65853 Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Thu, 22 Dec 2016 14:24:05 +0100 Subject: [PATCH 4/9] Optimize performance --- remote/gogs/gogs.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/remote/gogs/gogs.go b/remote/gogs/gogs.go index cbf2e81f9..98cc6f231 100644 --- a/remote/gogs/gogs.go +++ b/remote/gogs/gogs.go @@ -177,13 +177,14 @@ func (c *client) File(u *model.User, r *model.Repo, b *model.Build, f string) ([ client := c.newClientToken(u.Token) buildRef := b.Commit if buildRef == "" { - buildRef = b.Ref - // Remove refs/tags or refs/heads, Gogs needs a short ref - refPath := strings.SplitAfterN(b.Ref, "/", 3) - if len(refPath) > 0 { - buildRef = refPath[len(refPath)-1] - } + buildRef = strings.TrimPrefix( + strings.TrimPrefix( + b.Ref, + "refs/heads/", + ), + "refs/tags/", + ) } cfg, err := client.GetFile(r.Owner, r.Name, buildRef, f) return cfg, err From bcf39091557c8c30c23622e1d272a8a6bf01ea33 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 29 Dec 2016 11:16:51 -0500 Subject: [PATCH 5/9] Use default NOTICE log level for broker --- router/middleware/broker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/middleware/broker.go b/router/middleware/broker.go index 41b7d509e..400b68ef6 100644 --- a/router/middleware/broker.go +++ b/router/middleware/broker.go @@ -31,7 +31,7 @@ func Broker(cli *cli.Context) gin.HandlerFunc { // setup broker logging. log := redlog.New(os.Stderr) - log.SetLevel(0) + log.SetLevel(2) logger.SetLogger(log) if cli.Bool("broker-debug") { log.SetLevel(1) From f8f5fdfb40bbcb431268d6c27fc179232e3d7ea8 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 30 Dec 2016 09:33:19 -0500 Subject: [PATCH 6/9] Update README.md [ci skip] --- README.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9450729cf..3aad909b3 100644 --- a/README.md +++ b/README.md @@ -10,19 +10,7 @@ Drone's prime directive is to help teams [ship code like GitHub](https://github. ### Documentation -Drone documentation is organized into several categories: - -* [Setup Guide](http://readme.drone.io/setup/overview) -* [Build Guide](http://readme.drone.io/usage/overview) -* [Plugin Guide](http://readme.drone.io/devs/plugins) -* [CLI Reference](http://readme.drone.io/devs/cli/) -* [API Reference](http://readme.drone.io/devs/api/builds) - -### Documentation for 0.5 (unstable) - -If you are using the 0.5 unstable release (master branch) please see the updated [documentation](http://readme.drone.io/0.5). - - +Documentation is published to [readme.drone.io](http://readme.drone.io) ### Community, Help @@ -30,7 +18,7 @@ Contributions, questions, and comments are welcomed and encouraged. Drone develo ### Installation -Please see our [installation guide](http://readme.drone.io/setup/overview) to install the official Docker image. +Please see our [installation guide](http://readme.drone.io/admin/) to install the official Docker image. ### From Source From 141eb4ea571947deff756878a5b70dec06373137 Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Tue, 3 Jan 2017 09:38:05 +0100 Subject: [PATCH 7/9] Add pull_request webhook support to Gogs remote --- remote/gogs/fixtures/hooks.go | 52 ++++++++++++++++++++++ remote/gogs/helper.go | 40 +++++++++++++++++ remote/gogs/helper_test.go | 51 ++++++++++++++++++++++ remote/gogs/parse.go | 39 +++++++++++++++-- remote/gogs/types.go | 82 +++++++++++++++++++++++++++++++++++ 5 files changed, 261 insertions(+), 3 deletions(-) diff --git a/remote/gogs/fixtures/hooks.go b/remote/gogs/fixtures/hooks.go index fb04b2b37..0fd5eb19a 100644 --- a/remote/gogs/fixtures/hooks.go +++ b/remote/gogs/fixtures/hooks.go @@ -83,3 +83,55 @@ var HookPushTag = `{ "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" } }` + +// HookPullRequest is a sample pull_request webhook payload +var HookPullRequest = `{ + "action": "opened", + "number": 1, + "pull_request": { + "html_url": "http://gogs.golang.org/gordon/hello-world/pull/1", + "state": "open", + "title": "Update the README with new information", + "body": "please merge", + "user": { + "id": 1, + "username": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "http://gogs.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + }, + "base": { + "label": "master", + "ref": "master", + "sha": "9353195a19e45482665306e466c832c46560532d" + }, + "head": { + "label": "feature/changes", + "ref": "feature/changes", + "sha": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c" + } + }, + "repository": { + "id": 35129377, + "name": "hello-world", + "full_name": "gordon/hello-world", + "owner": { + "id": 1, + "username": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + }, + "private": true, + "html_url": "http://gogs.golang.org/gordon/hello-world", + "clone_url": "https://gogs.golang.org/gordon/hello-world.git", + "default_branch": "master" + }, + "sender": { + "id": 1, + "username": "gordon", + "full_name": "Gordon the Gopher", + "email": "gordon@golang.org", + "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" + } +}` diff --git a/remote/gogs/helper.go b/remote/gogs/helper.go index 157171015..e4f3e1387 100644 --- a/remote/gogs/helper.go +++ b/remote/gogs/helper.go @@ -112,6 +112,30 @@ func buildFromTag(hook *pushHook) *model.Build { } } +// helper function that extracts the Build data from a Gogs pull_request hook +func buildFromPullRequest(hook *pullRequestHook) *model.Build { + avatar := expandAvatar( + hook.Repo.URL, + fixMalformedAvatar(hook.PullRequest.User.Avatar), + ) + build := &model.Build{ + Event: model.EventPull, + Commit: hook.PullRequest.Head.Sha, + Link: hook.PullRequest.URL, + Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number), + Branch: hook.PullRequest.Base.Ref, + Message: hook.PullRequest.Title, + Author: hook.PullRequest.User.Username, + Avatar: avatar, + Title: hook.PullRequest.Title, + Refspec: fmt.Sprintf("%s:%s", + hook.PullRequest.Head.Ref, + hook.PullRequest.Base.Ref, + ), + } + return build +} + // helper function that extracts the Repository data from a Gogs push hook func repoFromPush(hook *pushHook) *model.Repo { return &model.Repo{ @@ -122,6 +146,16 @@ func repoFromPush(hook *pushHook) *model.Repo { } } +// helper function that extracts the Repository data from a Gogs pull_request hook +func repoFromPullRequest(hook *pullRequestHook) *model.Repo { + return &model.Repo{ + Name: hook.Repo.Name, + Owner: hook.Repo.Owner.Username, + FullName: hook.Repo.FullName, + Link: hook.Repo.URL, + } +} + // helper function that parses a push hook from a read closer. func parsePush(r io.Reader) (*pushHook, error) { push := new(pushHook) @@ -129,6 +163,12 @@ func parsePush(r io.Reader) (*pushHook, error) { return push, err } +func parsePullRequest(r io.Reader) (*pullRequestHook, error) { + pr := new(pullRequestHook) + err := json.NewDecoder(r).Decode(pr) + return pr, err +} + // fixMalformedAvatar is a helper function that fixes an avatar url if malformed // (currently a known bug with gogs) func fixMalformedAvatar(url string) string { diff --git a/remote/gogs/helper_test.go b/remote/gogs/helper_test.go index b3f91c6c2..f8ad2f4e0 100644 --- a/remote/gogs/helper_test.go +++ b/remote/gogs/helper_test.go @@ -53,6 +53,32 @@ func Test_parse(t *testing.T) { g.Assert(hook.Sender.Avatar).Equal("https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") }) + g.It("Should parse pull_request hook payload", func() { + buf := bytes.NewBufferString(fixtures.HookPullRequest) + hook, err := parsePullRequest(buf) + g.Assert(err == nil).IsTrue() + g.Assert(hook.Action).Equal("opened") + g.Assert(hook.Number).Equal(int64(1)) + + g.Assert(hook.Repo.Name).Equal("hello-world") + g.Assert(hook.Repo.URL).Equal("http://gogs.golang.org/gordon/hello-world") + g.Assert(hook.Repo.FullName).Equal("gordon/hello-world") + g.Assert(hook.Repo.Owner.Email).Equal("gordon@golang.org") + g.Assert(hook.Repo.Owner.Username).Equal("gordon") + g.Assert(hook.Repo.Private).Equal(true) + g.Assert(hook.Sender.Username).Equal("gordon") + g.Assert(hook.Sender.Avatar).Equal("https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") + + g.Assert(hook.PullRequest.Title).Equal("Update the README with new information") + g.Assert(hook.PullRequest.Body).Equal("please merge") + g.Assert(hook.PullRequest.State).Equal("open") + g.Assert(hook.PullRequest.User.Username).Equal("gordon") + g.Assert(hook.PullRequest.Base.Label).Equal("master") + g.Assert(hook.PullRequest.Base.Ref).Equal("master") + g.Assert(hook.PullRequest.Head.Label).Equal("feature/changes") + g.Assert(hook.PullRequest.Head.Ref).Equal("feature/changes") + }) + g.It("Should return a Build struct from a push hook", func() { buf := bytes.NewBufferString(fixtures.HookPush) hook, _ := parsePush(buf) @@ -78,6 +104,31 @@ func Test_parse(t *testing.T) { g.Assert(repo.Link).Equal(hook.Repo.URL) }) + g.It("Should return a Build struct from a pull_request hook", func() { + buf := bytes.NewBufferString(fixtures.HookPullRequest) + hook, _ := parsePullRequest(buf) + build := buildFromPullRequest(hook) + g.Assert(build.Event).Equal(model.EventPull) + g.Assert(build.Commit).Equal(hook.PullRequest.Head.Sha) + g.Assert(build.Ref).Equal("refs/pull/1/head") + g.Assert(build.Link).Equal(hook.PullRequest.URL) + g.Assert(build.Branch).Equal("master") + g.Assert(build.Message).Equal(hook.PullRequest.Title) + g.Assert(build.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") + g.Assert(build.Author).Equal(hook.PullRequest.User.Username) + + }) + + g.It("Should return a Repo struct from a pull_request hook", func() { + buf := bytes.NewBufferString(fixtures.HookPullRequest) + hook, _ := parsePullRequest(buf) + repo := repoFromPullRequest(hook) + g.Assert(repo.Name).Equal(hook.Repo.Name) + g.Assert(repo.Owner).Equal(hook.Repo.Owner.Username) + g.Assert(repo.FullName).Equal("gordon/hello-world") + g.Assert(repo.Link).Equal(hook.Repo.URL) + }) + g.It("Should return a Perm struct from a Gogs Perm", func() { perms := []gogs.Permission{ {true, true, true}, diff --git a/remote/gogs/parse.go b/remote/gogs/parse.go index f1e4f4429..6b3c1b60d 100644 --- a/remote/gogs/parse.go +++ b/remote/gogs/parse.go @@ -8,9 +8,15 @@ import ( ) const ( - hookEvent = "X-Gogs-Event" - hookPush = "push" - hookCreated = "create" + hookEvent = "X-Gogs-Event" + hookPush = "push" + hookCreated = "create" + hookPullRequest = "pull_request" + + actionOpen = "opened" + actionSync = "synchronize" + + stateOpen = "open" refBranch = "branch" refTag = "tag" @@ -24,6 +30,8 @@ func parseHook(r *http.Request) (*model.Repo, *model.Build, error) { return parsePushHook(r.Body) case hookCreated: return parseCreatedHook(r.Body) + case hookPullRequest: + return parsePullRequestHook(r.Body) } return nil, nil, nil } @@ -72,3 +80,28 @@ func parseCreatedHook(payload io.Reader) (*model.Repo, *model.Build, error) { build = buildFromTag(push) return repo, build, err } + +// parsePullRequestHook parses a pull_request hook and returns the Repo and Build details. +func parsePullRequestHook(payload io.Reader) (*model.Repo, *model.Build, error) { + var ( + repo *model.Repo + build *model.Build + ) + + pr, err := parsePullRequest(payload) + if err != nil { + return nil, nil, err + } + + // Don't trigger builds for non-code changes, or if PR is not open + if pr.Action != actionOpen && pr.Action != actionSync { + return nil, nil, nil + } + if pr.PullRequest.State != stateOpen { + return nil, nil, nil + } + + repo = repoFromPullRequest(pr) + build = buildFromPullRequest(pr) + return repo, build, err +} diff --git a/remote/gogs/types.go b/remote/gogs/types.go index 53e21bb5e..0b0949d46 100644 --- a/remote/gogs/types.go +++ b/remote/gogs/types.go @@ -40,3 +40,85 @@ type pushHook struct { Avatar string `json:"avatar_url"` } `json:"sender"` } + +type pullRequestHook struct { + Action string `json:"action"` + Number int64 `json:"number"` + PullRequest struct { + ID int64 `json:"id"` + User struct { + ID int64 `json:"id"` + Username string `json:"username"` + Name string `json:"full_name"` + Email string `json:"email"` + Avatar string `json:"avatar_url"` + } `json:"user"` + Title string `json:"title"` + Body string `json:"body"` + Labels []string `json:"labels"` + State string `json:"state"` + URL string `json:"html_url"` + Mergeable bool `json:"mergeable"` + Merged bool `json:"merged"` + MergeBase string `json:"merge_base"` + Base struct { + Label string `json:"label"` + Ref string `json:"ref"` + Sha string `json:"sha"` + Repo struct { + ID int64 `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` + URL string `json:"html_url"` + Private bool `json:"private"` + Owner struct { + ID int64 `json:"id"` + Username string `json:"username"` + Name string `json:"full_name"` + Email string `json:"email"` + Avatar string `json:"avatar_url"` + } `json:"owner"` + } `json:"repo"` + } `json:"base"` + Head struct { + Label string `json:"label"` + Ref string `json:"ref"` + Sha string `json:"sha"` + Repo struct { + ID int64 `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` + URL string `json:"html_url"` + Private bool `json:"private"` + Owner struct { + ID int64 `json:"id"` + Username string `json:"username"` + Name string `json:"full_name"` + Email string `json:"email"` + Avatar string `json:"avatar_url"` + } `json:"owner"` + } `json:"repo"` + } `json:"head"` + } `json:"pull_request"` + Repo struct { + ID int64 `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` + URL string `json:"html_url"` + Private bool `json:"private"` + Owner struct { + ID int64 `json:"id"` + Username string `json:"username"` + Name string `json:"full_name"` + Email string `json:"email"` + Avatar string `json:"avatar_url"` + } `json:"owner"` + } `json:"repository"` + Sender struct { + ID int64 `json:"id"` + Username string `json:"username"` + Name string `json:"full_name"` + Email string `json:"email"` + Avatar string `json:"avatar_url"` + } `json:"sender"` +} From e12b133b266827c56c1ed7f0533227d157c91f1a Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 3 Jan 2017 13:48:08 -0500 Subject: [PATCH 8/9] bump version --- .drone.yml | 2 +- .drone.yml.sig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2c364fc92..ebb6e9c2c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -34,7 +34,7 @@ pipeline: docker: image: plugins/docker repo: drone/drone - tag: [ "0.5", "0.5.0", "0.5.0-rc" ] + tag: [ "0.5", "0.5.0", "0.5.0-rc", "latest" ] when: branch: master event: push diff --git a/.drone.yml.sig b/.drone.yml.sig index 42b618e41..ee64beb1a 100644 --- a/.drone.yml.sig +++ b/.drone.yml.sig @@ -1 +1 @@ -eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9nbwogIHBhdGg6IHNyYy9naXRodWIuY29tL2Ryb25lL2Ryb25lCgpwaXBlbGluZToKICB0ZXN0OgogICAgaW1hZ2U6IGdvbGFuZzoxLjYKICAgIGVudmlyb25tZW50OgogICAgICAtIEdPMTVWRU5ET1JFWFBFUklNRU5UPTEKICAgIGNvbW1hbmRzOgogICAgICAtIG1ha2UgZGVwcyBnZW4KICAgICAgLSBtYWtlIHRlc3QgdGVzdF9wb3N0Z3JlcyB0ZXN0X215c3FsCgogIGNvbXBpbGU6CiAgICBpbWFnZTogZ29sYW5nOjEuNgogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gR08xNVZFTkRPUkVYUEVSSU1FTlQ9MQogICAgICAtIEdPUEFUSD0vZ28KICAgIGNvbW1hbmRzOgogICAgICAtIGV4cG9ydCBQQVRIPSRQQVRIOiRHT1BBVEgvYmluCiAgICAgIC0gbWFrZSBidWlsZAogICAgd2hlbjoKICAgICAgZXZlbnQ6IHB1c2gKCiAgcHVibGlzaDoKICAgIGltYWdlOiBwbHVnaW5zL3MzCiAgICBhY2w6IHB1YmxpYy1yZWFkCiAgICBidWNrZXQ6IGRvd25sb2Fkcy5kcm9uZS5pbwogICAgc291cmNlOiByZWxlYXNlLyoqLyouKgogICAgd2hlbjoKICAgICAgZXZlbnQ6IHB1c2gKICAgICAgYnJhbmNoOiBtYXN0ZXIKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBkcm9uZS9kcm9uZQogICAgdGFnOiBbICIwLjUiLCAiMC41LjAiLCAiMC41LjAtcmMiIF0KICAgIHdoZW46CiAgICAgIGJyYW5jaDogbWFzdGVyCiAgICAgIGV2ZW50OiBwdXNoCgpzZXJ2aWNlczoKICBwb3N0Z3JlczoKICAgIGltYWdlOiBwb3N0Z3Jlczo5LjQuNQogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gUE9TVEdSRVNfVVNFUj1wb3N0Z3JlcwogIG15c3FsOgogICAgaW1hZ2U6IG15c3FsOjUuNi4yNwogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gTVlTUUxfREFUQUJBU0U9dGVzdAogICAgICAtIE1ZU1FMX0FMTE9XX0VNUFRZX1BBU1NXT1JEPXllcwo.0lD1m6yILbU8ZrSJcZv7Y1CcGEG5zIaJma1C1lUTc7o \ No newline at end of file +eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9nbwogIHBhdGg6IHNyYy9naXRodWIuY29tL2Ryb25lL2Ryb25lCgpwaXBlbGluZToKICB0ZXN0OgogICAgaW1hZ2U6IGdvbGFuZzoxLjYKICAgIGVudmlyb25tZW50OgogICAgICAtIEdPMTVWRU5ET1JFWFBFUklNRU5UPTEKICAgIGNvbW1hbmRzOgogICAgICAtIG1ha2UgZGVwcyBnZW4KICAgICAgLSBtYWtlIHRlc3QgdGVzdF9wb3N0Z3JlcyB0ZXN0X215c3FsCgogIGNvbXBpbGU6CiAgICBpbWFnZTogZ29sYW5nOjEuNgogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gR08xNVZFTkRPUkVYUEVSSU1FTlQ9MQogICAgICAtIEdPUEFUSD0vZ28KICAgIGNvbW1hbmRzOgogICAgICAtIGV4cG9ydCBQQVRIPSRQQVRIOiRHT1BBVEgvYmluCiAgICAgIC0gbWFrZSBidWlsZAogICAgd2hlbjoKICAgICAgZXZlbnQ6IHB1c2gKCiAgcHVibGlzaDoKICAgIGltYWdlOiBwbHVnaW5zL3MzCiAgICBhY2w6IHB1YmxpYy1yZWFkCiAgICBidWNrZXQ6IGRvd25sb2Fkcy5kcm9uZS5pbwogICAgc291cmNlOiByZWxlYXNlLyoqLyouKgogICAgd2hlbjoKICAgICAgZXZlbnQ6IHB1c2gKICAgICAgYnJhbmNoOiBtYXN0ZXIKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBkcm9uZS9kcm9uZQogICAgdGFnOiBbICIwLjUiLCAiMC41LjAiLCAiMC41LjAtcmMiLCAibGF0ZXN0IiBdCiAgICB3aGVuOgogICAgICBicmFuY2g6IG1hc3RlcgogICAgICBldmVudDogcHVzaAoKc2VydmljZXM6CiAgcG9zdGdyZXM6CiAgICBpbWFnZTogcG9zdGdyZXM6OS40LjUKICAgIGVudmlyb25tZW50OgogICAgICAtIFBPU1RHUkVTX1VTRVI9cG9zdGdyZXMKICBteXNxbDoKICAgIGltYWdlOiBteXNxbDo1LjYuMjcKICAgIGVudmlyb25tZW50OgogICAgICAtIE1ZU1FMX0RBVEFCQVNFPXRlc3QKICAgICAgLSBNWVNRTF9BTExPV19FTVBUWV9QQVNTV09SRD15ZXMK.ySh4ipY6noAOTsiWDB6ji2g-c4DalL6qvawnzP_xRjY \ No newline at end of file From 64663aba7f7d2bb33725183b020ae2ef8783fb29 Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Tue, 3 Jan 2017 20:31:45 +0100 Subject: [PATCH 9/9] Enable all webhook events by default for Gogs remote --- remote/gogs/gogs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/remote/gogs/gogs.go b/remote/gogs/gogs.go index 98cc6f231..e5e77df2f 100644 --- a/remote/gogs/gogs.go +++ b/remote/gogs/gogs.go @@ -224,6 +224,7 @@ func (c *client) Activate(u *model.User, r *model.Repo, link string) error { hook := gogs.CreateHookOption{ Type: "gogs", Config: config, + Events: []string{"push", "create", "pull_request"}, Active: true, }