Merge pull request #1753 from devth/master
Add support for `drone build start foo/bar last`
This commit is contained in:
commit
9974d3bbea
1 changed files with 16 additions and 4 deletions
|
@ -35,16 +35,28 @@ func buildStart(c *cli.Context) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
number, err := strconv.Atoi(c.Args().Get(1))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := newClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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"))
|
params := parseKVPairs(c.StringSlice("param"))
|
||||||
|
|
||||||
var build *model.Build
|
var build *model.Build
|
||||||
|
|
Loading…
Reference in a new issue