Skip to content

Commit

Permalink
feat: add version information to executor (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockopp authored Jan 25, 2021
1 parent f2b8380 commit 6c05d4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/go-vela/pkg-executor/executor"
"github.com/go-vela/pkg-runtime/runtime"
"github.com/go-vela/worker/version"

"github.com/sirupsen/logrus"
)
Expand All @@ -23,6 +24,9 @@ import (
func (w *Worker) exec(index int) error {
var err error

// setup the version
v := version.New()

// setup the runtime
//
// https://pkg.go.dev/github.com/go-vela/pkg-runtime/runtime?tab=doc#New
Expand All @@ -49,6 +53,7 @@ func (w *Worker) exec(index int) error {
Pipeline: item.Pipeline.Sanitize(w.Config.Runtime.Driver),
Repo: item.Repo,
User: item.User,
Version: v.Semantic(),
})

// add the executor to the worker
Expand All @@ -58,9 +63,10 @@ func (w *Worker) exec(index int) error {
//
// https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#WithFields
logger := logrus.WithFields(logrus.Fields{
"build": item.Build.GetNumber(),
"host": w.Config.API.Address.Hostname(),
"repo": item.Repo.GetFullName(),
"build": item.Build.GetNumber(),
"host": w.Config.API.Address.Hostname(),
"repo": item.Repo.GetFullName(),
"version": v.Semantic(),
})

// capture the configured build timeout
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/gin-gonic/gin v1.6.3
github.com/go-vela/pkg-executor v0.7.0-rc2
github.com/go-vela/pkg-executor v0.7.0-rc2.0.20210125155500-a6fec1db703f
github.com/go-vela/pkg-queue v0.7.0-rc2
github.com/go-vela/pkg-runtime v0.7.0-rc2
github.com/go-vela/sdk-go v0.7.0-rc2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ github.com/go-vela/compiler v0.7.0-rc2 h1:oqEzF1rbQYTDepgWX5YWVmoPMHwYCPZFByb4WE
github.com/go-vela/compiler v0.7.0-rc2/go.mod h1:yDLkztd1U/29EPleiBbkNzPWnxxUwvKNGYMTX3pYPQ8=
github.com/go-vela/mock v0.7.0-rc2 h1:n+ugukio7vQrmOZ5D2td+BuGufqrT2HT3gZHO1UPeRc=
github.com/go-vela/mock v0.7.0-rc2/go.mod h1:PzRHohJqr9xLxpe8482/kwL9bHy2YuKtOhzMohxYaYk=
github.com/go-vela/pkg-executor v0.7.0-rc2 h1:Tlv6oMZDKU0CkT1GP3KsI6xmYEGvRGblD9Tz3Y/wdI4=
github.com/go-vela/pkg-executor v0.7.0-rc2/go.mod h1:fZSgpMre5zppQayDBXvHk+OhTc69IVzxEl0PnniVxPk=
github.com/go-vela/pkg-executor v0.7.0-rc2.0.20210125155500-a6fec1db703f h1:ONz4EBCrIXhQVsxnPL7g0xZEmdtIf82AhQUh5rpKslw=
github.com/go-vela/pkg-executor v0.7.0-rc2.0.20210125155500-a6fec1db703f/go.mod h1:fZSgpMre5zppQayDBXvHk+OhTc69IVzxEl0PnniVxPk=
github.com/go-vela/pkg-queue v0.7.0-rc2 h1:moOWGXmZXGgLnFEappElfkkrF1hj9yXA7D2B+47VDTA=
github.com/go-vela/pkg-queue v0.7.0-rc2/go.mod h1:UCfvqjVN+88FDApBRPdIQ/lgvpuoBsn8jyvsjwq9CnM=
github.com/go-vela/pkg-runtime v0.7.0-rc2 h1:/t1F4wXsGsk1vEdKH6asadD3IeK6ocjmaytlp1AwGXM=
Expand Down

0 comments on commit 6c05d4c

Please sign in to comment.