From bf4e300c9cd70cdf55a8161516e86533e0498e8c Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 10 Sep 2017 17:29:37 -0700 Subject: [PATCH] remove fork option, which is now default --- drone/build/build_start.go | 12 +---------- .../github.com/drone/drone-go/drone/client.go | 20 ++++++++----------- .../drone/drone-go/drone/interface.go | 7 +++---- .../github.com/drone/drone-go/drone/types.go | 19 +++++++++--------- vendor/vendor.json | 6 +++--- 5 files changed, 25 insertions(+), 39 deletions(-) diff --git a/drone/build/build_start.go b/drone/build/build_start.go index 945e736..d886eb3 100644 --- a/drone/build/build_start.go +++ b/drone/build/build_start.go @@ -6,7 +6,6 @@ import ( "strconv" "github.com/drone/drone-cli/drone/internal" - "github.com/drone/drone-go/drone" "github.com/urfave/cli" ) @@ -16,10 +15,6 @@ var buildStartCmd = cli.Command{ ArgsUsage: " [build]", Action: buildStart, Flags: []cli.Flag{ - cli.BoolFlag{ - Name: "fork", - Usage: "fork the build", - }, cli.StringSliceFlag{ Name: "param, p", Usage: "custom parameters to be injected into the job environment. Format: KEY=value", @@ -60,12 +55,7 @@ func buildStart(c *cli.Context) (err error) { params := internal.ParseKeyPair(c.StringSlice("param")) - var build *drone.Build - if c.Bool("fork") { - build, err = client.BuildFork(owner, name, number, params) - } else { - build, err = client.BuildStart(owner, name, number, params) - } + build, err := client.BuildStart(owner, name, number, params) if err != nil { return err } diff --git a/vendor/github.com/drone/drone-go/drone/client.go b/vendor/github.com/drone/drone-go/drone/client.go index 7cf5a43..9985146 100644 --- a/vendor/github.com/drone/drone-go/drone/client.go +++ b/vendor/github.com/drone/drone-go/drone/client.go @@ -17,6 +17,7 @@ const ( pathFeed = "%s/api/user/feed" pathRepos = "%s/api/user/repos" pathRepo = "%s/api/repos/%s/%s" + pathRepoMove = "%s/api/repos/%s/%s/move?to=%s" pathChown = "%s/api/repos/%s/%s/chown" pathRepair = "%s/api/repos/%s/%s/repair" pathBuilds = "%s/api/repos/%s/%s/builds" @@ -249,17 +250,6 @@ func (c *client) BuildStop(owner, name string, num, job int) error { return err } -// BuildFork re-starts a stopped build with a new build number, -// preserving the prior history. -func (c *client) BuildFork(owner, name string, num int, params map[string]string) (*Build, error) { - out := new(Build) - val := mapValues(params) - val.Set("fork", "true") - uri := fmt.Sprintf(pathBuild, c.addr, owner, name, num) - err := c.post(uri+"?"+val.Encode(), nil, out) - return out, err -} - // BuildApprove approves a blocked build. func (c *client) BuildApprove(owner, name string, num int) (*Build, error) { out := new(Build) @@ -293,7 +283,6 @@ func (c *client) BuildLogs(owner, name string, num, job int) (io.ReadCloser, err func (c *client) Deploy(owner, name string, num int, env string, params map[string]string) (*Build, error) { out := new(Build) val := mapValues(params) - val.Set("fork", "true") val.Set("event", "deployment") val.Set("deploy_to", env) uri := fmt.Sprintf(pathBuild, c.addr, owner, name, num) @@ -401,6 +390,13 @@ func (c *client) patch(rawurl string, in, out interface{}) error { return c.do(rawurl, "PATCH", in, out) } +// RepoMove moves a repository +func (c *client) RepoMove(owner, name, newFullName string) error { + uri := fmt.Sprintf(pathRepoMove, c.addr, owner, name, newFullName) + return c.post(uri, nil, nil) +} + + // helper function for making an http DELETE request. func (c *client) delete(rawurl string) error { return c.do(rawurl, "DELETE", nil, nil) diff --git a/vendor/github.com/drone/drone-go/drone/interface.go b/vendor/github.com/drone/drone-go/drone/interface.go index 2329aa0..b4b9754 100644 --- a/vendor/github.com/drone/drone-go/drone/interface.go +++ b/vendor/github.com/drone/drone-go/drone/interface.go @@ -33,6 +33,9 @@ type Client interface { // RepoPatch updates a repository. RepoPatch(string, string, *RepoPatch) (*Repo, error) + // RepoMove moves the repository + RepoMove(string, string, string) error + // RepoChown updates a repository owner. RepoChown(string, string) (*Repo, error) @@ -62,10 +65,6 @@ type Client interface { // BuildStop stops the specified running job for given build. BuildStop(string, string, int, int) error - // BuildFork re-starts a stopped build with a new build number, preserving - // the prior history. - BuildFork(string, string, int, map[string]string) (*Build, error) - // BuildApprove approves a blocked build. BuildApprove(string, string, int) (*Build, error) diff --git a/vendor/github.com/drone/drone-go/drone/types.go b/vendor/github.com/drone/drone-go/drone/types.go index 15df852..9fb3ace 100644 --- a/vendor/github.com/drone/drone-go/drone/types.go +++ b/vendor/github.com/drone/drone-go/drone/types.go @@ -37,15 +37,16 @@ type ( // RepoPatch defines a repository patch request. RepoPatch struct { - Config *string `json:"config_file,omitempty"` - IsTrusted *bool `json:"trusted,omitempty"` - IsGated *bool `json:"gated,omitempty"` - Timeout *int64 `json:"timeout,omitempty"` - Visibility *string `json:"visibility"` - AllowPull *bool `json:"allow_pr,omitempty"` - AllowPush *bool `json:"allow_push,omitempty"` - AllowDeploy *bool `json:"allow_deploy,omitempty"` - AllowTag *bool `json:"allow_tag,omitempty"` + Config *string `json:"config_file,omitempty"` + IsTrusted *bool `json:"trusted,omitempty"` + IsGated *bool `json:"gated,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` + Visibility *string `json:"visibility"` + AllowPull *bool `json:"allow_pr,omitempty"` + AllowPush *bool `json:"allow_push,omitempty"` + AllowDeploy *bool `json:"allow_deploy,omitempty"` + AllowTag *bool `json:"allow_tag,omitempty"` + BuildCounter *int `json:"build_counter,omitempty"` } // Build defines a build object. diff --git a/vendor/vendor.json b/vendor/vendor.json index 562e0db..a0012a1 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -273,10 +273,10 @@ "revisionTime": "2017-05-14T17:21:45Z" }, { - "checksumSHA1": "qLAnM1gmgrZfYrGCNE+nKYFrJAY=", + "checksumSHA1": "T1vAgV6ZikpXclSYb24tRbkjjiY=", "path": "github.com/drone/drone-go/drone", - "revision": "327c9594f784216a651dbaed30731600e496dd4e", - "revisionTime": "2017-08-01T19:17:01Z" + "revision": "d5a4e9da1d84a2e77f98ad2a3c50e1ebd7da5cb5", + "revisionTime": "2017-09-11T00:26:52Z" }, { "checksumSHA1": "pjMV8mwWcQ0Kk9cbLWweTGiqYPk=",