Add support for "drone build start foo/bar last"
This starts the build on the default branch
This commit is contained in:
parent
e28d85292a
commit
358243ed07
1 changed files with 16 additions and 4 deletions
|
@ -35,16 +35,28 @@ func buildStart(c *cli.Context) (err error) {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
number, err := strconv.Atoi(c.Args().Get(1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
client, err := newClient(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buildArg := c.Args().Get(1)
|
||||
var number int
|
||||
if buildArg == "last" {
|
||||
// Fetch the build number from the last build
|
||||
build, err := client.BuildLast(owner, name, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
number = build.Number
|
||||
} else {
|
||||
number, err = strconv.Atoi(buildArg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
params := parseKVPairs(c.StringSlice("param"))
|
||||
|
||||
var build *model.Build
|
||||
|
|
Loading…
Reference in a new issue