mirror of
https://github.com/drone/drone-cli.git
synced 2024-05-27 01:06:02 +02:00
remove fork option, which is now default
This commit is contained in:
parent
ee3fd53a95
commit
bf4e300c9c
|
@ -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: "<repo/name> [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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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=",
|
||||
|
|
Loading…
Reference in New Issue