Skip to content

Conversation

@timhuynh94
Copy link
Contributor

@timhuynh94 timhuynh94 commented Apr 9, 2025

Overview

This branch wires the worker into the new test reports + object storage pipeline by:


Architecture

1. Worker config + storage hookup

  • cmd/vela-worker/flags.go, run.go, worker.go
    • CLI now includes storage flags (driver, endpoint, access/secret key, bucket) and passes them into storage.Setup.
    • Worker gains fields for Storage *storage.Setup (config) and Storage storage.Storage (runtime client).
  • cmd/vela-worker/operate.go
    • On startup, the worker calls VelaClient.Storage.GetInfo() to fetch storage configuration from the server.
    • If storage is enabled, it:
      • Fills in any missing worker config (endpoint, bucket, access/secret).
      • Builds a storage client via storage.New(...).
      • Stores the client on w.Storage and logs driver/bucket/endpoint.
    • If storage is disabled, it explicitly clears storage config and sets w.Storage = nil.

2. Executor setup (linux/local)

  • executor.Setup now includes a Storage storage.Storage field.
  • cmd/vela-worker/exec.go
    • If w.Storage was successfully initialized, it is passed into the executor setup.
    • The executor is created from a populated executor.Setup struct instead of an inline literal.
  • executor/executor_test.go
    • Tests construct enabled/disabled storage setups and ensure:
      • Linux and local executors can be created with storage.
      • The top‑level executor respects the Storage field in executor.Setup.

3. Linux / local executor behavior for test reports

  • executor/linux/{build.go,stage.go,outputs.go,report.go,testattachments.go}
  • executor/local/{build.go,stage.go} and related tests

These pieces:

  • Thread the storage engine into the linux/local executor implementations.
  • When a pipeline step is configured with the test_report key, they:
    • Collect test result and attachment file paths from the runtime.
    • Use the storage client (when enabled) to move those files into the configured bucket.
    • Prepare the metadata so the server (via the Vela SDK) can associate uploads with test report / test attachment records.

4. Runtime integration

  • runtime/docker/test_report.go (+ test_report_test.go)
    • Adds Docker‑specific helpers for:
      • Discovering test result files in a container given paths from the pipeline definition.
      • Pulling those files out so the executor can upload them to storage / report them to the server.
  • runtime/engine.go
    • Wires the new test report helper into the runtime lifecycle so it runs at the appropriate point in a build.
  • runtime/kubernetes/container.go
    • Introduces PollFileNames as a no‑op for Kubernetes: test result file polling is not supported for dynamic pod environments yet.

5. Step skipping, middleware, and wiring

  • internal/step/skip.go (+ tests)
    • Updated to account for new behavior around test‑related steps and storage, so pipelines behave sensibly when storage is disabled or unavailable.
  • router/middleware/executor/executor_test.go
    • Ensures the executor wiring path continues to work with the new Storage field in executor.Setup.

6. Dependencies

  • go.mod, go.sum
    • Bump / align dependencies (including sdk-go, server storage packages, and Docker) to versions that include the new test‑report and storage APIs.

@KellyMerrick KellyMerrick changed the title Feat test report 1 feat(test reports): test_report key functionality Apr 14, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 14.53901% with 241 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.61%. Comparing base (ca78232) to head (9a6b314).

Files with missing lines Patch % Lines
runtime/docker/test_report.go 0.00% 91 Missing ⚠️
executor/linux/outputs.go 0.00% 38 Missing ⚠️
cmd/vela-worker/operate.go 0.00% 29 Missing ⚠️
executor/linux/testattachments.go 0.00% 27 Missing ⚠️
cmd/vela-worker/exec.go 0.00% 15 Missing ⚠️
executor/linux/build.go 41.17% 7 Missing and 3 partials ⚠️
cmd/vela-worker/run.go 0.00% 7 Missing ⚠️
runtime/kubernetes/container.go 0.00% 6 Missing ⚠️
executor/linux/opts.go 55.55% 2 Missing and 2 partials ⚠️
executor/local/opts.go 50.00% 2 Missing and 2 partials ⚠️
... and 4 more

❌ Your project check has failed because the head coverage (50.61%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #634      +/-   ##
==========================================
- Coverage   52.95%   50.61%   -2.35%     
==========================================
  Files         124      127       +3     
  Lines        5342     5613     +271     
==========================================
+ Hits         2829     2841      +12     
- Misses       2300     2548     +248     
- Partials      213      224      +11     
Files with missing lines Coverage Δ
executor/linux/linux.go 100.00% <ø> (ø)
executor/linux/stage.go 75.49% <100.00%> (ø)
executor/local/build.go 73.78% <100.00%> (ø)
executor/local/local.go 100.00% <ø> (ø)
executor/local/stage.go 71.83% <100.00%> (ø)
cmd/vela-worker/flags.go 0.00% <0.00%> (ø)
executor/setup.go 96.66% <81.81%> (-3.34%) ⬇️
executor/linux/report.go 76.92% <76.92%> (ø)
executor/linux/opts.go 95.40% <55.55%> (-4.60%) ⬇️
executor/local/opts.go 89.65% <50.00%> (-6.35%) ⬇️
... and 9 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timhuynh94 timhuynh94 marked this pull request as ready for review December 15, 2025 21:28
@timhuynh94 timhuynh94 requested a review from a team as a code owner December 15, 2025 21:28

// PollFileNames grabs test results and attachments from provided path within a container.
// This is a no-op for kubernetes. Pod environments cannot be dynamic.
func (c *client) PollFileNames(_ context.Context, ctn *pipeline.Container, paths []string) ([]string, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
unused-parameter: parameter 'paths' seems to be unused, consider removing or renaming it as _ (revive)


// PollFileContent captures the content and size of a file from the pipeline container.
// This is a no-op for kubernetes. Pod environments cannot be dynamic.
func (c *client) PollFileContent(_ context.Context, ctn *pipeline.Container, path string) (io.Reader, int64, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
unused-parameter: parameter 'path' seems to be unused, consider removing or renaming it as _ (revive)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants