Added ints to float64 for using with since helper.
This commit is contained in:
parent
4012b5da02
commit
008908029b
@ -53,7 +53,7 @@ steps:
|
|||||||
from_secret: discord_webhook_secret
|
from_secret: discord_webhook_secret
|
||||||
message: "
|
message: "
|
||||||
{{#success build.status}}
|
{{#success build.status}}
|
||||||
**{{repo.name}}#{{build.number}}@{{commit.sha}}** built in {{since build.started}} and pushed to hub.docker.com.
|
**{{repo.name}}#{{build.number}}@{{commit.sha}}** built in {{since build.startedint}} and pushed to hub.docker.com.
|
||||||
{{ else }}
|
{{ else }}
|
||||||
**{{repo.name}}#{{build.number}}@{{commit.sha}}** failed. See {{build.link}}.
|
**{{repo.name}}#{{build.number}}@{{commit.sha}}** failed. See {{build.link}}.
|
||||||
{{/success}}"
|
{{/success}}"
|
32
env/env.go
vendored
32
env/env.go
vendored
@ -1,10 +1,11 @@
|
|||||||
package env
|
package env
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
// stdlib
|
||||||
|
"fmt"
|
||||||
|
|
||||||
// other
|
// other
|
||||||
"github.com/vrischmann/envconfig"
|
"github.com/vrischmann/envconfig"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Data *environmentData
|
var Data *environmentData
|
||||||
@ -17,15 +18,18 @@ type environmentData struct {
|
|||||||
Drone struct {
|
Drone struct {
|
||||||
Branch string `envconfig:"optional"`
|
Branch string `envconfig:"optional"`
|
||||||
Build struct {
|
Build struct {
|
||||||
Action string `envconfig:"optional"`
|
Action string `envconfig:"optional"`
|
||||||
Created float64 `envconfig:"optional"`
|
Created float64 `envconfig:"optional"`
|
||||||
Event string `envconfig:"optional"`
|
CreatedInt int `envconfig:"optional"`
|
||||||
Finished float64 `envconfig:"optional"`
|
Event string `envconfig:"optional"`
|
||||||
Link string `envconfig:"optional"`
|
Finished float64 `envconfig:"optional"`
|
||||||
Number int `envconfig:"optional"`
|
FinishedInt int `envconfig:"optional"`
|
||||||
Parent string `envconfig:"optional"`
|
Link string `envconfig:"optional"`
|
||||||
Started float64 `envconfig:"optional"`
|
Number int `envconfig:"optional"`
|
||||||
Status string `envconfig:"optional"`
|
Parent string `envconfig:"optional"`
|
||||||
|
Started float64 `envconfig:"optional"`
|
||||||
|
StartedInt int `envconfig:"optional"`
|
||||||
|
Status string `envconfig:"optional"`
|
||||||
}
|
}
|
||||||
CommitHash string `envconfig:"DRONE_COMMIT,optional"`
|
CommitHash string `envconfig:"DRONE_COMMIT,optional"`
|
||||||
Commit struct {
|
Commit struct {
|
||||||
@ -141,3 +145,9 @@ func ParseEnv() {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ed *environmentData) ConvertFloatToInts() {
|
||||||
|
ed.Drone.Build.CreatedInt = int(ed.Drone.Build.Created)
|
||||||
|
ed.Drone.Build.FinishedInt = int(ed.Drone.Build.Finished)
|
||||||
|
ed.Drone.Build.StartedInt = int(ed.Drone.Build.Started)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user