From be2c206c20d907ba25a3e8a348d4bee1dece87cf Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 11 Sep 2020 06:35:41 -0700 Subject: [PATCH] Add missing fields for Build (#19) Both DRONE_BUILD_LINK and DRONE_DEPLOY_ID were missing from the list of environment variables in the drone-runner library. --- drone/build.go | 6 ++++++ urfave/build.go | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drone/build.go b/drone/build.go index 8620a19..ec0cd0d 100644 --- a/drone/build.go +++ b/drone/build.go @@ -42,6 +42,9 @@ type Build struct { // Status of the build. Status string + // Link to the build. + Link string + // Created time of the build. Created time.Time @@ -54,6 +57,9 @@ type Build struct { // DeployTo the environment. DeployTo string + // DeployID for the environment. + DeployID int + // FailedStages of the build. FailedStages []string diff --git a/urfave/build.go b/urfave/build.go index 1cdb15b..a0942f7 100644 --- a/urfave/build.go +++ b/urfave/build.go @@ -65,6 +65,11 @@ func buildFlags() []cli.Flag { Usage: "build status", EnvVars: []string{"DRONE_BUILD_STATUS"}, }, + &cli.StringFlag{ + Name: "build.link", + Usage: "build link", + EnvVars: []string{"DRONE_BUILD_LINK"}, + }, &cli.StringFlag{ Name: "build.created", Usage: "build created", @@ -85,6 +90,11 @@ func buildFlags() []cli.Flag { Usage: "build deploy to", EnvVars: []string{"DRONE_DEPLOY_TO"}, }, + &cli.IntFlag{ + Name: "build.deploy-id", + Usage: "build deploy id", + EnvVars: []string{"DRONE_DEPLOY_ID"}, + }, &cli.StringSliceFlag{ Name: "build.failed-stages", Usage: "build failed stages", @@ -111,10 +121,12 @@ func buildFromContext(ctx *cli.Context) drone.Build { Event: ctx.String("build.event"), Action: ctx.String("build.action"), Status: ctx.String("build.status"), + Link: ctx.String("build.link"), Created: time.Unix(ctx.Int64("build.created"), 0), Started: time.Unix(ctx.Int64("build.started"), 0), Finished: time.Unix(ctx.Int64("build.finished"), 0), DeployTo: ctx.String("build.deploy-to"), + DeployID: ctx.Int("build.deploy-id"), FailedStages: ctx.StringSlice("build.failed-stages"), FailedSteps: ctx.StringSlice("build.failed-steps"), }