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.
This commit is contained in:
Don 2020-09-11 06:35:41 -07:00 committed by GitHub
parent 1f4e8862b8
commit be2c206c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

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

View File

@ -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"),
}