Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 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
30fcc52
feat(artifacts): remove reports layer, chg attachments to artifacts, …
KellyMerrick Jan 12, 2026
36437fa
code change to support sts and remove database
Z003J76_tgt Feb 3, 2026
c66a088
Merge branch 'main' into feat_artifacts
timhuynh94 Feb 3, 2026
57b4be0
point gomod to feat_artifacts branches
Z003J76_tgt Feb 3, 2026
1a542f6
remove artfiact db
Z003J76_tgt Feb 3, 2026
5a7acb6
use build service getSTS
Z003J76_tgt Feb 6, 2026
dd183bf
Merge branch 'main' into feat_artifacts
timhuynh94 Feb 11, 2026
7e69206
fix linters
Z003J76_tgt Feb 11, 2026
ba622ee
Merge branch 'feat_artifacts' of https://github.com/go-vela/worker in…
Z003J76_tgt Feb 11, 2026
51b9ff1
enhance(outputs): use docker client CopyFromContainer for outputs
ecrupper Feb 11, 2026
98620e1
revert docker compose
ecrupper Feb 11, 2026
0032683
Merge remote-tracking branch 'origin/enhance/docker-native-outputs-ex…
Z003J76_tgt Feb 11, 2026
740d0e8
use docker copyFromContainer
Z003J76_tgt Feb 11, 2026
750a7aa
fix lints
Z003J76_tgt Feb 12, 2026
ac77afe
Merge branch 'main' into feat_artifacts
timhuynh94 Feb 13, 2026
f9af839
use vela_workspace for finding files
Z003J76_tgt Feb 16, 2026
2c7a651
use vela_workspace for finding files
Z003J76_tgt Feb 16, 2026
99c9e03
fix lints
Z003J76_tgt Feb 16, 2026
528ade2
remove filetypes
Z003J76_tgt Feb 19, 2026
c8dc836
fix gosec lint
Z003J76_tgt Feb 23, 2026
bf83ce3
fix linters
Z003J76_tgt Feb 24, 2026
86a6a7a
use CopyFromContainer for finding matching files, update docker compo…
ecrupper Feb 24, 2026
ef707cf
Revert "use CopyFromContainer for finding matching files, update dock…
ecrupper Feb 24, 2026
0beebef
add back goodies from previous commit
ecrupper Feb 24, 2026
4dc1870
add tests
timhuynh94 Feb 24, 2026
2f79cc3
Merge branch 'main' into feat_artifacts
timhuynh94 Feb 25, 2026
c7126fb
make clean
timhuynh94 Feb 25, 2026
3f5f4de
linter
ecrupper Feb 25, 2026
dc5601d
fix linters
timhuynh94 Feb 25, 2026
dfa9274
fix linters
timhuynh94 Feb 25, 2026
23a1d4b
add file size limits
ecrupper Feb 25, 2026
c6519df
add default values
ecrupper Feb 26, 2026
76e6081
switch to using storage service to upload
timhuynh94 Feb 26, 2026
23ffc9c
Merge branch 'feat_artifacts' of https://github.com/go-vela/worker in…
timhuynh94 Feb 26, 2026
73867ad
use creds values
timhuynh94 Feb 26, 2026
3711470
update to rc2
timhuynh94 Feb 26, 2026
e3af51c
Merge branch 'main' into feat_artifacts
timhuynh94 Feb 26, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ secrets.env

# Dotenv environment file
.env
.env_*
.env.test

# Files to be excluded.
Expand Down
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ linters:
gosec:
excludes:
- G101 # hardcoded credentials
- G117 # exported field of "Secret" style
- G117
- G705 # exported field of "Secret" style
# https://github.com/client9/misspell
misspell:
locale: US
Expand Down Expand Up @@ -158,6 +159,7 @@ linters:
allow-first-in-block: true
allow-whole-block: false
branch-max-lines: 2

exclusions:
generated: lax
presets:
Expand Down
18 changes: 13 additions & 5 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import (
//
//nolint:gocyclo,funlen // ignore cyclomatic complexity and function length
func (w *Worker) exec(ctx context.Context, index int, config *api.Worker) error {
var err error
var (
err error
_executor executor.Engine
)

// setup the version
v := version.New()
Expand Down Expand Up @@ -144,8 +147,6 @@ func (w *Worker) exec(ctx context.Context, index int, config *api.Worker) error
// prepare pipeline by hydrating container ID values based on build information
p.Prepare(item.Build.GetRepo().GetOrg(), item.Build.GetRepo().GetName(), item.Build.GetNumber(), false)

logrus.Debugf("setting up exec client with scm token %s with expiration %d", p.Token, p.TokenExp)

// setup exec client with scm token and build token
execBuildClient, err = setupExecClient(w.Config.Server, bt.GetToken(), p.Token, p.TokenExp, item.Build)
if err != nil {
Expand Down Expand Up @@ -238,11 +239,13 @@ func (w *Worker) exec(ctx context.Context, index int, config *api.Worker) error
// 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,
MaxLogSize: w.Config.Executor.MaxLogSize,
FileSizeLimit: w.Config.Executor.FileSizeLimit,
BuildFileSizeLimit: w.Config.Executor.BuildFileSizeLimit,
LogStreamingTimeout: w.Config.Executor.LogStreamingTimeout,
EnforceTrustedRepos: w.Config.Executor.EnforceTrustedRepos,
PrivilegedImages: w.Config.Runtime.PrivilegedImages,
Expand All @@ -253,8 +256,13 @@ func (w *Worker) exec(ctx context.Context, index int, config *api.Worker) error
Pipeline: p.Sanitize(w.Config.Runtime.Driver),
Version: v.Semantic(),
OutputCtn: &execOutputCtn,
})
}

_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
12 changes: 12 additions & 0 deletions cmd/vela-worker/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ func flags() []cli.Flag {
Sources: cli.EnvVars("WORKER_BUILD_TIMEOUT", "VELA_BUILD_TIMEOUT", "BUILD_TIMEOUT"),
Value: 30 * time.Minute,
},
&cli.IntFlag{
Name: "storage.file-size-limit",
Usage: "maximum file size (in MB) for a single file upload. 0 means no limit.",
Sources: cli.EnvVars("WORKER_STORAGE_FILE_SIZE_LIMIT", "VELA_STORAGE_FILE_SIZE_LIMIT", "STORAGE_FILE_SIZE_LIMIT"),
Value: 100,
},
&cli.IntFlag{
Name: "storage.build-file-size-limit",
Usage: "maximum total size (in MB) for all file uploads in a single build. 0 means no limit.",
Sources: cli.EnvVars("WORKER_STORAGE_BUILD_FILE_SIZE_LIMIT", "VELA_STORAGE_BUILD_FILE_SIZE_LIMIT", "STORAGE_BUILD_FILE_SIZE_LIMIT"),
Value: 500,
},

// Logger Flags

Expand Down
2 changes: 2 additions & 0 deletions cmd/vela-worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func run(ctx context.Context, c *cli.Command) error {
Executor: &executor.Setup{
Driver: c.String("executor.driver"),
MaxLogSize: c.Uint("executor.max_log_size"),
FileSizeLimit: c.Int("storage.file-size-limit"),
BuildFileSizeLimit: c.Int("storage.build-file-size-limit"),
LogStreamingTimeout: c.Duration("executor.log_streaming_timeout"),
EnforceTrustedRepos: c.Bool("executor.enforce-trusted-repos"),
OutputCtn: outputsCtn,
Expand Down
48 changes: 48 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ services:
VELA_DISABLE_WEBHOOK_VALIDATION: 'true'
VELA_ENABLE_SECURE_COOKIE: 'false'
VELA_REPO_ALLOWLIST: '*'
VELA_SCHEDULE_ALLOWLIST: '*'
VELA_OTEL_TRACING_ENABLE: true
VELA_OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
VELA_OTEL_TRACING_SAMPLER_RATELIMIT_PER_SECOND: 100
VELA_STORAGE_ENABLE: true
VELA_STORAGE_DRIVER: minio
VELA_STORAGE_ADDRESS: 'http://minio:9001' # Address of the MinIO server
VELA_STORAGE_ACCESS_KEY: minioadmin
VELA_STORAGE_SECRET_KEY: minioadmin
VELA_STORAGE_USE_SSL: 'false'
VELA_STORAGE_BUCKET: vela
env_file:
- .env
restart: always
Expand Down Expand Up @@ -161,5 +172,42 @@ services:
cap_add:
- IPC_LOCK

# The `minio` compose service hosts the MinIO server instance.
#
# This component is used for storing build artifacts.
#
# https://min.io/
minio:
container_name: minio
image: minio/minio
restart: always
ports:
- '9001:9001'
- '9002:9002'
networks:
- vela
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
command: minio server --address ":9001" --console-address ":9002" /data

# The `minio-setup` compose service is used for setting up the MinIO server instance.
#
# This component is used for creating the bucket and setting permissions.
minio-setup:
image: minio/mc
container_name: minio-setup
depends_on:
- minio
networks:
- vela
entrypoint: >
/bin/sh -c '
until mc alias set local http://minio:9001 minioadmin minioadmin; do sleep 1; done;
mc mb --ignore-existing local/vela;
mc anonymous set none local/vela;
'
restart: "no"

networks:
vela:
7 changes: 7 additions & 0 deletions executor/linux/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@ func (c *client) ExecBuild(ctx context.Context) error {
if c.err != nil {
return fmt.Errorf("unable to execute step: %w", c.err)
}

if len(_step.Artifacts.Paths) != 0 {
err := c.outputs.pollFiles(ctx, c.OutputCtn, _step, c.build)
if err != nil {
c.Logger.Errorf("unable to poll files for artifacts: %v", err)
}
}
}

// create an error group with the context for each stage
Expand Down
1 change: 0 additions & 1 deletion executor/linux/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ func TestLinux_CreateBuild(t *testing.T) {
WithBuild(test.build),
WithPipeline(_pipeline),
WithRuntime(_runtime),

WithVelaClient(_client),
)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions executor/linux/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ import "github.com/go-vela/server/constants"
func (c *client) Driver() string {
return constants.DriverLinux
}

// StorageDriver outputs the configured storage driver.
func (c *client) StorageDriver() string {
return constants.DriverMinio
}
5 changes: 5 additions & 0 deletions executor/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type (
Hostname string
Version string
OutputCtn *pipeline.Container
Uploaded int64

// clients for build actions
secret *secretSvc
Expand All @@ -37,6 +38,8 @@ type (
// private fields
init *pipeline.Container
maxLogSize uint
fileSizeLimit int64
buildFileSizeLimit int64
logStreamingTimeout time.Duration
privilegedImages []string
enforceTrustedRepos bool
Expand Down Expand Up @@ -74,6 +77,8 @@ func Equal(a, b *client) bool {
a.Version == b.Version &&
reflect.DeepEqual(a.init, b.init) &&
a.maxLogSize == b.maxLogSize &&
a.fileSizeLimit == b.fileSizeLimit &&
a.buildFileSizeLimit == b.buildFileSizeLimit &&
reflect.DeepEqual(a.privilegedImages, b.privilegedImages) &&
a.enforceTrustedRepos == b.enforceTrustedRepos &&
reflect.DeepEqual(a.build, b.build) &&
Expand Down
24 changes: 24 additions & 0 deletions executor/linux/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ func WithMaxLogSize(size uint) Opt {
}
}

// WithFileSizeLimit sets the maximum file size (in MB) for a single file upload in the executor client for Linux.
func WithFileSizeLimit(limit int) Opt {
return func(c *client) error {
c.Logger.Trace("configuring file size limit in linux executor client")

// set the file size limit in the client
c.fileSizeLimit = int64(limit) * 1024 * 1024

return nil
}
}

// WithBuildFileSizeLimit sets the maximum total size (in MB) for all file uploads in a single build in the executor client for Linux.
func WithBuildFileSizeLimit(limit int) Opt {
return func(c *client) error {
c.Logger.Trace("configuring build file size limit in linux executor client")

// set the build file size limit in the client
c.buildFileSizeLimit = int64(limit) * 1024 * 1024

return nil
}
}

// WithLogStreamingTimeout sets the log streaming timeout in the executor client for Linux.
func WithLogStreamingTimeout(timeout time.Duration) Opt {
return func(c *client) error {
Expand Down
47 changes: 47 additions & 0 deletions executor/linux/opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,53 @@ func TestLinux_Opt_WithBuild(t *testing.T) {
}

func TestLinux_Opt_WithMaxLogSize(t *testing.T) {
// setup tests
tests := []struct {
name string
failure bool
fileSizeLimit int
buildFileSizeLimit int
}{
{
name: "defined",
failure: false,
fileSizeLimit: 200,
buildFileSizeLimit: 1000,
},
}

// run tests
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
_engine, err := New(
WithFileSizeLimit(test.fileSizeLimit),
WithBuildFileSizeLimit(test.buildFileSizeLimit),
)

if test.failure {
if err == nil {
t.Errorf("WithFileSizeLimit should have returned err")
}

return // continue to next test
}

if err != nil {
t.Errorf("WithFileSizeLimit returned err: %v", err)
}

if !reflect.DeepEqual(_engine.fileSizeLimit, int64(test.fileSizeLimit*1024*1024)) {
t.Errorf("WithFileSizeLimit is %v, want %v", _engine.fileSizeLimit, int64(test.fileSizeLimit*1024*1024))
}

if !reflect.DeepEqual(_engine.buildFileSizeLimit, int64(test.buildFileSizeLimit*1024*1024)) {
t.Errorf("WithBuildFileSizeLimit is %v, want %v", _engine.buildFileSizeLimit, int64(test.buildFileSizeLimit*1024*1024))
}
})
}
}

func TestLinux_Opt_WithFileSizeLimit(t *testing.T) {
// setup tests
tests := []struct {
name string
Expand Down
Loading