support tag string.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-11-24 09:37:19 +08:00
parent b688f301ba
commit 70655117a2
4 changed files with 9 additions and 0 deletions

View File

@ -77,6 +77,7 @@ docker run --rm \
-e DRONE_BUILD_NUMBER=1 \ -e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \ -e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://github.com/appleboy/go-hello \ -e DRONE_BUILD_LINK=http://github.com/appleboy/go-hello \
-e DRONE_TAG=1.0.0 \
-e DRONE_JOB_STARTED=1477550550 \ -e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \ -e DRONE_JOB_FINISHED=1477550750 \
-v $(pwd):$(pwd) \ -v $(pwd):$(pwd) \

View File

@ -147,6 +147,11 @@ func main() {
Usage: "build link", Usage: "build link",
EnvVar: "DRONE_BUILD_LINK", EnvVar: "DRONE_BUILD_LINK",
}, },
cli.StringFlag{
Name: "build.tag",
Usage: "build tag",
EnvVar: "DRONE_TAG",
},
cli.Float64Flag{ cli.Float64Flag{
Name: "job.started", Name: "job.started",
Usage: "job started", Usage: "job started",
@ -177,6 +182,7 @@ func run(c *cli.Context) error {
Name: c.String("repo.name"), Name: c.String("repo.name"),
}, },
Build: Build{ Build: Build{
Tag: c.String("build.tag"),
Number: c.Int("build.number"), Number: c.Int("build.number"),
Event: c.String("build.event"), Event: c.String("build.event"),
Status: c.String("build.status"), Status: c.String("build.status"),

View File

@ -21,6 +21,7 @@ type (
// Build information. // Build information.
Build struct { Build struct {
Tag string
Event string Event string
Number int Number int
Commit string Commit string

View File

@ -56,6 +56,7 @@ func TestSendMessage(t *testing.T) {
Owner: "appleboy", Owner: "appleboy",
}, },
Build: Build{ Build: Build{
Tag: "1.0.0",
Number: 101, Number: 101,
Status: "success", Status: "success",
Link: "https://github.com/appleboy/go-hello", Link: "https://github.com/appleboy/go-hello",