Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
aad77ed
test report execution logic
Apr 7, 2025
802831e
fix(int): fix int types
Apr 7, 2025
e7a30eb
Merge branch 'fix_int_types' into feat_test_report_1
Apr 7, 2025
309d53a
changes
Apr 8, 2025
aeb5c30
chore(urfave cli): bump to v3
KellyMerrick Apr 8, 2025
e2749c2
converting some of the flags
KellyMerrick Apr 8, 2025
aa3edbf
Merge branch 'fix_int_types' of github.com:go-vela/worker into bump-u…
KellyMerrick Apr 8, 2025
86a2d9b
more v3
KellyMerrick Apr 8, 2025
f022c7a
more changes to v3
Apr 8, 2025
4a522db
Merge branch 'bump-urfave-v3' into feat_test_report_1
Apr 8, 2025
060aceb
chore(deps): update server to current main
KellyMerrick Apr 8, 2025
e2ec2b9
Merge branch 'bump-urfave-v3' into feat_test_report_1
Apr 9, 2025
a52952d
point to latest sdk-go
Apr 9, 2025
ec9dafa
add back missing code
Apr 9, 2025
6d37f5a
Merge branch 'main' into feat_test_report_1
timhuynh94 Apr 9, 2025
f42e676
add back missing code
Apr 9, 2025
76529b1
upload with build number
Apr 11, 2025
012d17e
fix(test reports): use build number instead of build id
KellyMerrick May 20, 2025
c26d850
feat(test reports): try testreport add db record
KellyMerrick Jun 17, 2025
7886bd1
Merge branch 'main' into feat_test_report_1
timhuynh94 Jun 24, 2025
e7fa8e6
Merge branch 'main' into feat_test_report_1
timhuynh94 Jul 3, 2025
9e63c7b
update docker package
Jul 3, 2025
b85a4c6
Merge branch 'main' into feat_test_report_1
timhuynh94 Jul 8, 2025
54eccc6
refactor code
Jul 14, 2025
02bc917
add testattachment
Jul 15, 2025
a3300f5
Merge branch 'main' into feat_test_report_1
timhuynh94 Aug 22, 2025
9c829e5
make clean
Aug 22, 2025
746ba27
point to sdk go branch
Aug 22, 2025
c0affe8
Merge branch 'main' into feat_test_report_1
timhuynh94 Aug 26, 2025
788af04
gomod tidy
Aug 26, 2025
085a207
fixing linters
Aug 27, 2025
e9a7ced
Potential fix for code scanning alert no. 5: Clear-text logging of se…
timhuynh94 Aug 27, 2025
fe11078
add and fix tests
Aug 28, 2025
14d8645
golanci run fix
Aug 28, 2025
ee65782
Merge branch 'main' into feat_test_report_1
timhuynh94 Sep 29, 2025
5e08770
point to server branch
Sep 29, 2025
319412f
non working code
Oct 14, 2025
2b63a1c
non working code
Oct 14, 2025
4bfe330
working but skip step
Oct 15, 2025
0fe9168
working with enabled
Oct 15, 2025
419a687
working with enabled
Oct 16, 2025
605d9a4
fix skip test
Oct 23, 2025
76efee5
point to server branch
Oct 23, 2025
3991c62
update for presigned url
Nov 12, 2025
6b3ef9a
fix conflicts
Dec 1, 2025
9a6b314
fix liniting
Dec 15, 2025
46db70b
enhance: use context for API calls and refresh install token
ecrupper Dec 30, 2025
bcdc2b4
restore some defaults
ecrupper Dec 30, 2025
8a358d7
linter
ecrupper Dec 30, 2025
8c8d2bc
feat(test attachments): merge in main
KellyMerrick Jan 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

"github.com/go-vela/sdk-go/vela"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"

Check failure on line 17 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/compiler/types/pipeline (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 17 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/compiler/types/pipeline (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 17 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/compiler/types/pipeline (imported by github.com/go-vela/worker/cmd/vela-worker); to add:
"github.com/go-vela/server/constants"

Check failure on line 18 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/constants (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 18 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/constants (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 18 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/constants (imported by github.com/go-vela/worker/cmd/vela-worker); to add:
"github.com/go-vela/server/queue/models"

Check failure on line 19 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue/models (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 19 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue/models (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 19 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue/models (imported by github.com/go-vela/worker/cmd/vela-worker); to add:
"github.com/go-vela/server/storage"

Check failure on line 20 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/storage (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 20 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/storage (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 20 in cmd/vela-worker/exec.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/storage (imported by github.com/go-vela/worker/cmd/vela-worker); to add:
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
"github.com/go-vela/worker/version"
Expand All @@ -29,6 +30,10 @@
func (w *Worker) exec(ctx context.Context, index int, config *api.Worker) error {
var err error

var execStorage storage.Storage

var _executor executor.Engine

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

Expand Down Expand Up @@ -158,6 +163,14 @@
execOutputCtn := *w.Config.Executor.OutputCtn
execOutputCtn.ID = fmt.Sprintf("outputs_%s", p.ID)

if w.Storage != nil {
execStorage = w.Storage

logrus.Debugf("executor storage is available, setting up storage")
} else {
logrus.Debugf("executor storage is nil, skipping storage setup")
}

// create logger with extra metadata
//
// https://pkg.go.dev/github.com/sirupsen/logrus#WithFields
Expand Down Expand Up @@ -235,7 +248,7 @@
// setup the executor
//
// https://pkg.go.dev/github.com/go-vela/worker/executor#New
_executor, err := executor.New(&executor.Setup{
setup := &executor.Setup{
Logger: logger,
Mock: w.Config.Mock,
Driver: w.Config.Executor.Driver,
Expand All @@ -250,8 +263,19 @@
Pipeline: p.Sanitize(w.Config.Runtime.Driver),
Version: v.Semantic(),
OutputCtn: &execOutputCtn,
})
}

if execStorage != nil {
fmt.Printf("setting up executor storage\n")

setup.Storage = execStorage
}

_executor, err = executor.New(setup)
if err != nil {
logger.Errorf("unable to setup executor: %v", err)
return err
}
// add the executor to the worker
w.Executors[index] = _executor

Expand Down
4 changes: 4 additions & 0 deletions cmd/vela-worker/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

"github.com/urfave/cli/v3"

"github.com/go-vela/server/queue"

Check failure on line 13 in cmd/vela-worker/flags.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 13 in cmd/vela-worker/flags.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue (imported by github.com/go-vela/worker/cmd/vela-worker); to add:

Check failure on line 13 in cmd/vela-worker/flags.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/go-vela/server/queue (imported by github.com/go-vela/worker/cmd/vela-worker); to add:
"github.com/go-vela/server/storage"
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
)
Expand Down Expand Up @@ -120,5 +121,8 @@

f = append(f, runtime.Flags...)

// Storage Flags
f = append(f, storage.Flags...)

return f
}
55 changes: 54 additions & 1 deletion cmd/vela-worker/operate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/queue"
"github.com/go-vela/server/storage"
)

// operate is a helper function to initiate all
// subprocesses for the operator to poll the
// queue and execute Vela pipelines.
//
//nolint:funlen // refactor candidate
//nolint:funlen,gocyclo // refactor candidate
func (w *Worker) operate(ctx context.Context) error {
var err error
// create the errgroup for managing operator subprocesses
Expand Down Expand Up @@ -77,6 +78,58 @@ func (w *Worker) operate(ctx context.Context) error {
w.updateWorkerStatus(ctx, registryWorker, constants.WorkerStatusError)
}

// getting storage creds
logrus.Trace("getting storage s3 creds..")
// fetching queue credentials using registration token
stCreds, _, err := w.VelaClient.Storage.GetInfo(ctx)
if err != nil {
logrus.Tracef("error getting storage creds: %v", err)
return err
}

if stCreds.GetEnabled() {
logrus.Trace("storage enabled")
// if an address was given at start up, use that — else use what is returned from server
if len(w.Config.Storage.Endpoint) == 0 {
w.Config.Storage.Endpoint = stCreds.GetStorageAddress()
}

// set access key in storage config
w.Config.Storage.AccessKey = stCreds.GetAccessKey()

// set secret key in storage config
w.Config.Storage.SecretKey = stCreds.GetSecretKey()

// set bucket name in storage config
w.Config.Storage.Bucket = stCreds.GetStorageBucket()

// set storage enabled to true
w.Config.Storage.Enable = stCreds.GetEnabled()

s, err := storage.New(w.Config.Storage)
if err != nil {
logrus.Error("storage setup failed")
// set to error as storage setup fails
w.updateWorkerStatus(ctx, registryWorker, constants.WorkerStatusError)

return err
}

w.Storage = s
logrus.WithFields(logrus.Fields{
"driver": w.Config.Storage.Driver,
"bucket": w.Config.Storage.Bucket,
"endpoint": w.Config.Storage.Endpoint,
}).Debug("storage initialized")
} else {
logrus.Trace("storage not enabled")
// storage disabled; nothing to validate
w.Config.Storage.Enable = false
w.Storage = nil

logrus.Debug("storage disabled: worker storage unset")
}

// spawn goroutine for phoning home
executors.Go(func() error {
// five second ticker for signal handling
Expand Down
8 changes: 8 additions & 0 deletions cmd/vela-worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/queue"
"github.com/go-vela/server/storage"
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
)
Expand Down Expand Up @@ -138,6 +139,13 @@ func run(ctx context.Context, c *cli.Command) error {
Address: c.String("server.addr"),
Secret: c.String("server.secret"),
},
Storage: &storage.Setup{
Driver: c.String("storage.driver"),
Endpoint: c.String("storage.endpoint.name"),
AccessKey: c.String("storage.access.key"),
SecretKey: c.String("storage.secret.key"),
Bucket: c.String("storage.bucket.name"),
},
// Certificate configuration
Certificate: &Certificate{
Cert: c.String("server.cert"),
Expand Down
3 changes: 3 additions & 0 deletions cmd/vela-worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/go-vela/sdk-go/vela"
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/queue"
"github.com/go-vela/server/storage"
"github.com/go-vela/worker/executor"
"github.com/go-vela/worker/runtime"
)
Expand Down Expand Up @@ -57,6 +58,7 @@ type (
Server *Server
Certificate *Certificate
TLSMinVersion string
Storage *storage.Setup
}

// Worker represents all configuration and
Expand All @@ -72,5 +74,6 @@ type (
RunningBuilds []*api.Build
QueueCheckedIn bool
RunningBuildsMutex sync.Mutex
Storage storage.Storage
}
)
41 changes: 41 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/mock/server"
"github.com/go-vela/server/storage"
"github.com/go-vela/worker/executor/linux"
"github.com/go-vela/worker/executor/local"
"github.com/go-vela/worker/runtime/docker"
Expand All @@ -37,6 +38,38 @@ func TestExecutor_New(t *testing.T) {
t.Errorf("unable to create runtime engine: %v", err)
}

_storageT := &storage.Setup{
Enable: true,
Driver: "minio",
Endpoint: "http://localhost:9000",
AccessKey: "ad",
SecretKey: "asd",
Bucket: "vela",
Region: "",
Secure: false,
}

_sT, err := storage.New(_storageT)
if err != nil {
t.Errorf("unable to create storage engine: %v", err)
}

_storageF := &storage.Setup{
Enable: false,
Driver: "",
Endpoint: "",
AccessKey: "",
SecretKey: "",
Bucket: "",
Region: "",
Secure: false,
}

_sF, err := storage.New(_storageF)
if err != nil {
t.Errorf("unable to create storage engine: %v", err)
}

_linux, err := linux.New(
linux.WithBuild(_build),
linux.WithHostname("localhost"),
Expand All @@ -45,6 +78,7 @@ func TestExecutor_New(t *testing.T) {
linux.WithRuntime(_runtime),
linux.WithVelaClient(_client),
linux.WithVersion("v1.0.0"),
linux.WithStorage(_sT),
)
if err != nil {
t.Errorf("unable to create linux engine: %v", err)
Expand All @@ -57,6 +91,7 @@ func TestExecutor_New(t *testing.T) {
local.WithRuntime(_runtime),
local.WithVelaClient(_client),
local.WithVersion("v1.0.0"),
local.WithStorage(_sT),
)
if err != nil {
t.Errorf("unable to create local engine: %v", err)
Expand All @@ -80,6 +115,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sF,
},
want: nil,
equal: reflect.DeepEqual,
Expand All @@ -95,6 +131,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sT,
},
want: _linux,
equal: linux.Equal,
Expand All @@ -109,6 +146,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sT,
},
want: _local,
equal: local.Equal,
Expand All @@ -123,6 +161,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sT,
},
want: nil,
equal: reflect.DeepEqual,
Expand All @@ -137,6 +176,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sT,
},
want: nil,
equal: reflect.DeepEqual,
Expand All @@ -151,6 +191,7 @@ func TestExecutor_New(t *testing.T) {
Pipeline: _pipeline,
Runtime: _runtime,
Version: "v1.0.0",
Storage: _sT,
},
want: nil,
equal: reflect.DeepEqual,
Expand Down
Loading
Loading