Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
feat(build): add email and link fields (#27)
Browse files Browse the repository at this point in the history
* chore: update go-vela dependencies

* feat(build): add email and link env vars
  • Loading branch information
jbrockopp authored and KellyMerrick committed Dec 16, 2019
1 parent b1abe33 commit 8ba9fe8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
35 changes: 19 additions & 16 deletions compiler/native/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,25 @@ func environment(b *library.Build, m *types.Metadata, r *library.Repo, u *librar

env := map[string]string{
// build specific environment variables
"BUILD_BRANCH": b.GetBranch(),
"BUILD_CHANNEL": "TODO",
"BUILD_COMMIT": b.GetCommit(),
"BUILD_CREATED": unmarshal(b.GetCreated()),
"BUILD_ENQUEUED": unmarshal(b.GetEnqueued()),
"BUILD_EVENT": b.GetEvent(),
"BUILD_FINISHED": unmarshal(b.GetFinished()),
"BUILD_HOST": "TODO",
"BUILD_MESSAGE": b.GetMessage(),
"BUILD_NUMBER": unmarshal(b.GetNumber()),
"BUILD_PARENT": unmarshal(b.GetParent()),
"BUILD_REF": b.GetRef(),
"BUILD_STARTED": unmarshal(b.GetStarted()),
"BUILD_SOURCE": b.GetSource(),
"BUILD_TITLE": b.GetTitle(),
"BUILD_WORKSPACE": workspace,
"BUILD_AUTHOR": b.GetAuthor(),
"BUILD_AUTHOR_EMAIL": b.GetEmail(),
"BUILD_BRANCH": b.GetBranch(),
"BUILD_CHANNEL": "TODO",
"BUILD_COMMIT": b.GetCommit(),
"BUILD_CREATED": unmarshal(b.GetCreated()),
"BUILD_ENQUEUED": unmarshal(b.GetEnqueued()),
"BUILD_EVENT": b.GetEvent(),
"BUILD_FINISHED": unmarshal(b.GetFinished()),
"BUILD_HOST": "TODO",
"BUILD_LINK": b.GetLink(),
"BUILD_MESSAGE": b.GetMessage(),
"BUILD_NUMBER": unmarshal(b.GetNumber()),
"BUILD_PARENT": unmarshal(b.GetParent()),
"BUILD_REF": b.GetRef(),
"BUILD_STARTED": unmarshal(b.GetStarted()),
"BUILD_SOURCE": b.GetSource(),
"BUILD_TITLE": b.GetTitle(),
"BUILD_WORKSPACE": workspace,

// vela specific environment variables
"VELA": unmarshal(true),
Expand Down
3 changes: 3 additions & 0 deletions compiler/native/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ func TestNative_environment(t *testing.T) {
workspace := fmt.Sprintf("/home/%s_%s_%d", r.GetOrg(), r.GetName(), b.GetNumber())

want := map[string]string{
"BUILD_AUTHOR": b.GetAuthor(),
"BUILD_AUTHOR_EMAIL": b.GetEmail(),
"BUILD_BRANCH": b.GetBranch(),
"BUILD_CHANNEL": m.Queue.Channel,
"BUILD_COMMIT": b.GetCommit(),
Expand All @@ -194,6 +196,7 @@ func TestNative_environment(t *testing.T) {
"BUILD_EVENT": b.GetEvent(),
"BUILD_FINISHED": unmarshal(b.GetFinished()),
"BUILD_HOST": "TODO",
"BUILD_LINK": b.GetLink(),
"BUILD_MESSAGE": b.GetMessage(),
"BUILD_NUMBER": unmarshal(b.GetNumber()),
"BUILD_PARENT": unmarshal(b.GetParent()),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.5.0
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-vela/types v0.2.0-rc2.0.20191212190851-8d734fb40372
github.com/go-vela/types v0.2.0-rc2.0.20191216174112-50b01810eb81
github.com/google/go-github/v24 v24.0.1
github.com/google/uuid v1.1.1 // indirect
github.com/goware/urlx v0.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rm
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-vela/types v0.2.0-rc2.0.20191212190851-8d734fb40372 h1:PKyQuV3YtqGVD3u/sEeuDkyym5l3Svc5a2+tRNBdzcA=
github.com/go-vela/types v0.2.0-rc2.0.20191212190851-8d734fb40372/go.mod h1:LNDrn7/nV38H0HmRfYv6YfPNb881R5NRE1YKXeVqpF4=
github.com/go-vela/types v0.2.0-rc2.0.20191216174112-50b01810eb81 h1:NlWiQMY27E8MTeiA+/brl0OD0o781lU2WSdEGUxaN94=
github.com/go-vela/types v0.2.0-rc2.0.20191216174112-50b01810eb81/go.mod h1:LNDrn7/nV38H0HmRfYv6YfPNb881R5NRE1YKXeVqpF4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down

0 comments on commit 8ba9fe8

Please sign in to comment.