Merge pull request #1753 from devth/master

Add support for `drone build start foo/bar last`
This commit is contained in:
Brad Rydzewski 2016-08-11 16:18:16 -07:00 committed by GitHub
commit 9974d3bbea

View file

@ -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