Skip to content

perf(ci): remove container from ui, shell, roxctl, openshift-ci jobs#19745

Draft
davdhacs wants to merge 8 commits intomasterfrom
davdhacs/remove-container-other-tests
Draft

perf(ci): remove container from ui, shell, roxctl, openshift-ci jobs#19745
davdhacs wants to merge 8 commits intomasterfrom
davdhacs/remove-container-other-tests

Conversation

@davdhacs
Copy link
Copy Markdown
Contributor

@davdhacs davdhacs commented Apr 1, 2026

Description

Remove CI container from non-Go-test jobs, running directly on ubuntu-latest:

  • ui: remove container, add setup-node
  • ui-component: remove container, replace make ui-component-tests with cypress-io/github-action@v7 (caches Cypress binary automatically)
  • local-roxctl-tests: remove container, add setup-go + GOTOOLCHAIN=auto
  • shell-unit-tests: remove container, add bats-core/bats-action (bats not available on ubuntu-latest by default)
  • openshift-ci-unit-tests: remove container (only needs Python, available on ubuntu-latest)

Saves ~55s container init per job. Independent of Go test container removal (#19743).

Stacked on #19712 (host-runner test fixes).
Split from #19678.

User-facing documentation

Testing and quality

  • the change is production ready
  • CI results are inspected

Automated testing

  • modified existing tests

How I validated my change

Previously validated on #19678.

🤖 Generated with Claude Code

davdhacs and others added 5 commits March 31, 2026 10:06
Fix tests and scripts to work on ubuntu-latest host runners (no
container) in addition to CI container environments.

- rate_limited_logger.go: add /home/runner/work/ path prefix
  (container used /__w/)
- download_zip_test.go: accept ErrPermission for /root/ paths
  (non-root runner returns permission denied, not not-found)
- detection_test.go: delete circular test
- lib.sh: escape & in bash 5.2+ replacements (verified 4.4-5.3)
- helpers.bash: add yq_multidoc helper (yq 4.x adds --- separators)
- roxctl-netpol-generate-*.bats: use yq_multidoc

All changes are backward-compatible with container environments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
grep -v returns exit code 1 when no lines match (e.g. yq output is
only --- separators), which would look like a yq failure. sed always
returns 0 regardless of whether lines were deleted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Run remaining unit-tests jobs directly on ubuntu-latest:

- ui: remove container, add setup-node
- ui-component: remove container, use cypress-io/github-action
- local-roxctl-tests: remove container, add setup-go
- shell-unit-tests: remove container, add bats-core/bats-action
- openshift-ci-unit-tests: remove container

Depends on #19712 (host-runner test fixes).
Split from #19678.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 1, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • By replacing make ui-component-tests with cypress-io/github-action@v7, make sure any project-specific setup that make used to perform (builds, env vars, custom reporters, config flags) is not lost; if it did more than just run Cypress, consider extracting that logic into a reusable script invoked by the Cypress action.
  • For long-lived CI workflow dependencies like cypress-io/github-action@v7 and bats-core/bats-action@v4.0.0, consider pinning to a specific commit SHA instead of a moving tag to keep runs reproducible and avoid unexpected behavior changes from upstream updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- By replacing `make ui-component-tests` with `cypress-io/github-action@v7`, make sure any project-specific setup that `make` used to perform (builds, env vars, custom reporters, config flags) is not lost; if it did more than just run Cypress, consider extracting that logic into a reusable script invoked by the Cypress action.
- For long-lived CI workflow dependencies like `cypress-io/github-action@v7` and `bats-core/bats-action@v4.0.0`, consider pinning to a specific commit SHA instead of a moving tag to keep runs reproducible and avoid unexpected behavior changes from upstream updates.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rhacs-bot
Copy link
Copy Markdown
Contributor

rhacs-bot commented Apr 1, 2026

Images are ready for the commit at eb7f80b.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-534-geb7f80b76b.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.60%. Comparing base (f8de23e) to head (eb7f80b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19745   +/-   ##
=======================================
  Coverage   49.59%   49.60%           
=======================================
  Files        2760     2760           
  Lines      208144   208144           
=======================================
+ Hits       103239   103244    +5     
+ Misses      97239    97237    -2     
+ Partials     7666     7663    -3     
Flag Coverage Δ
go-unit-tests 49.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@davdhacs davdhacs changed the base branch from davdhacs/host-runner-test-fixes to master April 1, 2026 19:58
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved JUnit test report XML generation accuracy
    • Enhanced logging path handling for GitHub Actions environments
    • Updated security validation tests for path traversal prevention
  • Tests

    • Added multi-document YAML parsing support for integration tests
    • Updated network policy generation tests to handle multiple output documents
  • Chores

    • Updated CI workflow tooling for Node.js, Go, and shell testing environments

Walkthrough

CI/CD workflows transition from Docker container execution to native setup actions for Node.js, Go, and Bash tooling. Test infrastructure updates include helper functions for multi-document YAML processing and assertion loosening for security testing. Production code updates add GitHub Actions workspace path trimming to logging and fix XML entity escaping in CI scripts.

Changes

Cohort / File(s) Summary
CI/CD Workflow Configuration
.github/workflows/unit-tests.yaml, scripts/ci/lib.sh
Removed Docker container execution environments and added actions/setup-node@v6, actions/setup-go@v6, and bats-core/bats-action@v4.0.0. Fixed Bash XML-escaping for ampersands in JUnit output with proper replacement patterns.
Test Infrastructure
tests/roxctl/bats-tests/helpers.bash, tests/roxctl/bats-tests/local/roxctl-netpol-generate-*.bats
Added yq_multidoc() helper to filter YAML document separators and updated multi-document YAML assertions in development and release test files to use the new helper.
Test Adjustments
pkg/containers/detection_test.go, roxctl/common/zipdownload/download_zip_test.go
Removed TestContainerDetection test and loosened path traversal verification to accept both fs.ErrNotExist and fs.ErrPermission error conditions.
Logging Updates
pkg/logging/rate_limited_logger.go
Added GitHub Actions workspace path prefix (/home/runner/work/stackrox/stackrox/) trimming to getTrimmedFilePath for rate-limited log key computation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: removing the CI container from multiple job types (ui, shell, roxctl, openshift-ci) to improve performance by eliminating container initialization overhead.
Description check ✅ Passed The description covers the main changes for each affected job, explains the performance benefit (~55s savings), notes dependencies and stacking, and addresses user-facing documentation and testing requirements, though CI results inspection is deferred.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch davdhacs/remove-container-other-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/unit-tests.yaml (2)

330-331: Prefer a job-level env for GOTOOLCHAIN.

Lines 330-331 work, but they make the toolchain contract depend on step order. Declaring GOTOOLCHAIN: auto on local-roxctl-tests keeps it visible next to the rest of the job configuration and automatically covers any future Go-related step inserted above this one.

♻️ Suggested cleanup
  local-roxctl-tests:
    runs-on: ubuntu-latest
+   env:
+     GOTOOLCHAIN: auto
    outputs:
      new-jiras: ${{ steps.junit2jira.outputs.new-jiras }}
...
-    - name: Override GOTOOLCHAIN
-      run: echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/unit-tests.yaml around lines 330 - 331, Move the
GOTOOLCHAIN assignment from a step that appends to $GITHUB_ENV into the
job-level environment for the local-roxctl-tests job: remove the step that runs
echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV" and instead add GOTOOLCHAIN: auto under
the env block for the local-roxctl-tests job so the variable is declared
alongside the job configuration and applies to all steps consistently.

235-237: Pin the newly added action refs to immutable SHAs.

Lines 235-237, 274-277, 283-288, 325-328, and Line 373 add more mutable @v* refs. That keeps the host-runner migration simple, but it also means upstream retagging can change CI behavior without a repo change. Please pin the new actions to full commit SHAs before this lands.

Also applies to: 274-277, 283-288, 325-328, 373-373

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/unit-tests.yaml around lines 235 - 237, Replace mutable
action refs (e.g., actions/setup-node@v6, actions/checkout@v4, actions/cache@v4,
dorny/paths-filter@v2, etc.) with their immutable full commit SHAs in the
workflow so upstream retags can't silently change CI behavior: locate each usage
of those action refs (the occurrences added around the referenced lines) and
update the ref from the short `@v`* tag to the corresponding full commit SHA from
the action's GitHub repository, keeping the rest of the step config identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/unit-tests.yaml:
- Around line 330-331: Move the GOTOOLCHAIN assignment from a step that appends
to $GITHUB_ENV into the job-level environment for the local-roxctl-tests job:
remove the step that runs echo "GOTOOLCHAIN=auto" >> "$GITHUB_ENV" and instead
add GOTOOLCHAIN: auto under the env block for the local-roxctl-tests job so the
variable is declared alongside the job configuration and applies to all steps
consistently.
- Around line 235-237: Replace mutable action refs (e.g., actions/setup-node@v6,
actions/checkout@v4, actions/cache@v4, dorny/paths-filter@v2, etc.) with their
immutable full commit SHAs in the workflow so upstream retags can't silently
change CI behavior: locate each usage of those action refs (the occurrences
added around the referenced lines) and update the ref from the short `@v`* tag to
the corresponding full commit SHA from the action's GitHub repository, keeping
the rest of the step config identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a17df3ea-3ad3-447c-8c85-3cf75f640dd2

📥 Commits

Reviewing files that changed from the base of the PR and between f8de23e and 51ff1db.

📒 Files selected for processing (8)
  • .github/workflows/unit-tests.yaml
  • pkg/containers/detection_test.go
  • pkg/logging/rate_limited_logger.go
  • roxctl/common/zipdownload/download_zip_test.go
  • scripts/ci/lib.sh
  • tests/roxctl/bats-tests/helpers.bash
  • tests/roxctl/bats-tests/local/roxctl-netpol-generate-development.bats
  • tests/roxctl/bats-tests/local/roxctl-netpol-generate-release.bats
💤 Files with no reviewable changes (1)
  • pkg/containers/detection_test.go

davdhacs and others added 2 commits April 1, 2026 15:04
- local-roxctl-tests: add bats-core/bats-action (bats not on ubuntu-latest)
- openshift-ci-unit-tests: install pycodestyle (was in CI container)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bats-core/bats-action uses 4.0.0, not v4.0.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants