Skip to content

ci(bazel): run root tests, quarantine flaky go-lib, add missing service rows#311

Merged
balajinvda merged 9 commits into
mainfrom
ci/enable-root-tests
Jul 21, 2026
Merged

ci(bazel): run root tests, quarantine flaky go-lib, add missing service rows#311
balajinvda merged 9 commits into
mainfrom
ci/enable-root-tests

Conversation

@balajinvda

@balajinvda balajinvda commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Why

The root Bazel matrix row ran with tests_skip: true, so no root tests ran in
CI at all: not nvcf-cli, not the Java example, not any src/libraries/go/lib
package. The blanket skip existed only because two go-lib areas fail in the
GitHub Actions environment:

  • //src/libraries/go/lib/pkg/core/... (core_test goroutine-leak detector)
  • //src/libraries/go/lib/pkg/icms-translate/... (env-flaky)

What changed

  • Flip the root row to run tests (tests_skip: false).

  • Quarantine just the two known-flaky packages via
    .github/bazel-root-test-quarantine.txt. Its negative Bazel patterns are
    appended after the positive test patterns, so Bazel subtracts them from the
    resolved set. This works for both the full //... set and a narrowed
    affected-target set, and the file lives at the repo root so the subtraction
    applies only to the root row.

  • Do not edit the native go-lib BUILD files (they are source, not GitHub-only
    mirror files); the quarantine is a CI-side list the nvcf-go team clears as
    they fix each package.

  • Add the 6 buildable services that were missing from the detect matrix:
    byoo-otel-collector, nvcf-unbound, and the four workers (worker-init,
    worker-llm-credentials, worker-task, worker-utils). Each has its own
    MODULE.bazel and a public OCI base, but was never a matrix row, so a change
    touching only one of them (surfaced by fix(byoo-otel-collector): log otelcol-contrib exit error on shutdown #219 for byoo) skipped Bazel entirely
    with a green check. nvsnap stays excluded (private OCI base, documented).

  • Additional matrix fixes surfaced by the new coverage:

    • worker-llm-credentials: completed its rules/oci copy (was missing
      defs.bzl/transition.bzl/private/*), which broke its build.
    • byoo-otel-collector: bumped the workflow image bazel-ci:0.8.0 -> 0.11.0
      (Go baked in) for its otelcol-contrib genrule.
    • Root remote-cache warming: force --remote_upload_local_results=true on main
      so root actually uploads (its .bazelrc --config=remote had pinned it off).
    • Affected-target narrowing: diff against the PR base SHA instead of the
      unresolvable origin/<branch> ref inside the container.

Customer Release Notes

Not customer visible (CI only).

Plan Summary

Not applicable.

Usage

Not applicable.

Testing

YAML parses; every run: block passes bash -n; the quarantine subtraction was
verified to produce //... plus the two negative patterns. This PR itself edits
a non-Go file, so its root job full-builds and runs the whole root test suite
minus the quarantine: a green root job confirms the quarantine set is sufficient;
a red one names any additional failing package to add.

Notes

This is the test-coverage counterpart to #283's build-speed work. The two
quarantined packages are owned by nvcf-go for a test-layer fix (goroutine-leak
cleanup and the environment dependency); production code must not change to make
them pass. When the file is empty, the whole root module is under test.

Issues

Relates to #284

Related Merge Requests/Pull Requests

Follows #280

Dependencies

None

Summary by CodeRabbit

  • Chores

    • Updated Bazel CI to run the root test suite while excluding only a curated set of quarantined flaky Go packages, and adjusted target discovery to use the PR base commit SHA with safer fallback behavior.
    • Upgraded the Bazel CI container image and made remote cache upload behavior explicit to ensure consistent caching.
    • Changed Bazel remote cache to be opt-in rather than enabled by default.
  • New Features

    • Added reusable Bazel/Starlark helpers for packaging Go binaries into multi-architecture OCI images and optionally pushing tagged images.
  • Documentation

    • Documented the quarantined root test list format and which tests are excluded vs. kept.

The root matrix row ran with tests_skip: true, so no root tests ran in CI
(nvcf-cli, the Java example, and all go-lib packages). The skip existed only
because two go-lib areas fail in the GitHub Actions environment: pkg/core
(core_test goroutine-leak detector) and pkg/icms-translate (env-flaky).

Enable the row's tests and quarantine just those two packages via
.github/bazel-root-test-quarantine.txt, whose negative patterns are subtracted
from the resolved test set (works for both the full //... set and a narrowed
affected set). The file lives at the repo root, so the subtraction applies only
to the root row. nvcf-go owns the test-layer fix; removing an entry restores its
coverage (#284).

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@balajinvda
balajinvda requested a review from a team as a code owner July 21, 2026 14:16
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Bazel workflow now runs root tests with targeted quarantines, resolves PR diffs from the base commit, uses explicit cache controls, and adds reusable Starlark rules for packaging Go binaries as multi-architecture OCI images.

Changes

Bazel CI test selection

Layer / File(s) Summary
Quarantine pattern contract
.github/bazel-root-test-quarantine.txt, .github/workflows/bazel.yml
Defines negative Bazel patterns and documents targeted root-test quarantine.
Root test selection and matrix wiring
.github/workflows/bazel.yml
Enables root tests, adds compute-plane-service entries, and subtracts configured quarantine patterns from the root test set.
Base resolution and cache controls
.github/workflows/bazel.yml, .bazelrc
Updates the CI image, PR base diffing, remote-cache opt-in documentation, and explicit build/test cache-upload flags.

Go OCI image rules

Layer / File(s) Summary
Multi-architecture transition rule
src/compute-plane-services/worker-llm-credentials/rules/oci/transition.bzl
Maps configured platforms into Bazel transitions and exposes image outputs.
OCI image composition
src/compute-plane-services/worker-llm-credentials/rules/oci/private/common.bzl
Builds platform-specific images, an OCI index, local outputs, and optional registry push targets.
Go binary image macro
src/compute-plane-services/worker-llm-credentials/rules/oci/private/go.bzl, src/compute-plane-services/worker-llm-credentials/rules/oci/defs.bzl
Packages Go binaries into OCI layers and re-exports the public go_oci_image macro.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BazelCI as Bazel CI workflow
  participant Quarantine as Quarantine file
  participant Bazel as Bazel test
  BazelCI->>Quarantine: Read negative selectors
  Quarantine-->>BazelCI: Return quarantined patterns
  BazelCI->>Bazel: Run root tests with negated selectors
  Bazel-->>BazelCI: Return filtered test results
Loading
sequenceDiagram
  participant GoBinary
  participant GoOCI as go_oci_image
  participant OCIComposition as create_oci_image
  participant OCIIndex as oci_image_index
  GoBinary->>GoOCI: Provide binary target
  GoOCI->>OCIComposition: Create binary tar layer and image targets
  OCIComposition->>OCIIndex: Aggregate platform images
Loading

Possibly related issues

Possibly related PRs

  • NVIDIA/nvcf#280 — Also updates Bazel workflow root-row selection logic.

Suggested reviewers: sbaum1994

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main CI changes: enabling root tests, quarantining flaky targets, and adding missing service rows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/enable-root-tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/bazel.yml:
- Around line 431-442: Update the root-change detection configuration,
specifically ROOT_GLOBS, to include .github/bazel-root-test-quarantine.txt so
changes to that file select the root CI row. Preserve the existing detection
behavior for all other root patterns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e29dc3f4-01e8-44e7-8210-d91fea754e25

📥 Commits

Reviewing files that changed from the base of the PR and between 5ef95ed and 6db7bb5.

📒 Files selected for processing (2)
  • .github/bazel-root-test-quarantine.txt
  • .github/workflows/bazel.yml

Comment thread .github/workflows/bazel.yml
balajinvda and others added 2 commits July 21, 2026 09:01
The first enabled root test run (78 tests, 76 pass) showed the real failing
set differs from the old blanket-skip comment:
- //src/libraries/go/lib:gazelle_test fails 3/3 (committed BUILD files are
  stale vs the pinned Gazelle; a codegen fix, not flakiness).
- //src/libraries/go/lib/cmd/icms-translate:icms-translate_test fails 3/3.
- pkg/icms-translate uses process-global os.Setenv in tests (env-flaky).

pkg/nvkit/auth:auth_test is genuinely flaky (timing) but recovers under
--flaky_test_attempts=3, so it is not quarantined. pkg/core is not
quarantined: the old goroutine-leak claim is unsupported (no leak detector in
its tests), so its tests now run and stand or fall on their own.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
byoo-otel-collector, nvcf-unbound, and the four workers (worker-init,
worker-llm-credentials, worker-task, worker-utils) each have their own
MODULE.bazel and a public OCI base (nvcr.io/nvidia/distroless/go, digest
anonymously pullable), but were never added as matrix rows. So a change
touching only one of them (e.g. #219 for byoo, which even edits cli_test.go)
matched no row, produced an empty matrix, and skipped Bazel entirely with a
green check. Add them so their build and tests run on PRs and main.

nvsnap remains the only intentional exclusion (private, non-public OCI base;
see the detect comment). Rows start with tests enabled; any that fail tests in
the GHA environment will be flipped to build-only with a tracking issue, per
the documented policy.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@balajinvda balajinvda changed the title test(ci): run root bazel tests, quarantine known-flaky go-lib packages ci(bazel): run root tests, quarantine flaky go-lib, add missing service rows Jul 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/bazel.yml (1)

443-446: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle an empty quarantine file without failing CI.

With set -euo pipefail, grep returns status 1 when the file contains only comments or blank lines, causing the pipeline at Line 446 to fail. The contract says an empty file should run the entire root module.

Suggested fix
-            grep -E '^[[:space:]]*-//' "$qfile" | sed -E 's/^[[:space:]]+//' >> "$ttfile"
+            awk '/^[[:space:]]*-\/\// { sub(/^[[:space:]]+/, ""); print }' "$qfile" >> "$ttfile"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/bazel.yml around lines 443 - 446, Update the
quarantine-file parsing around qfile, n, and the grep/sed pipeline so files
containing only comments or blank lines do not fail under set -euo pipefail.
Treat such a file as having no quarantined targets and preserve the existing
behavior that runs the entire root module.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/bazel.yml:
- Around line 443-446: Update the quarantine-file parsing around qfile, n, and
the grep/sed pipeline so files containing only comments or blank lines do not
fail under set -euo pipefail. Treat such a file as having no quarantined targets
and preserve the existing behavior that runs the entire root module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 03e61c6b-fe29-450a-9221-d996fb293df7

📥 Commits

Reviewing files that changed from the base of the PR and between 47d5fa4 and 39e2d1c.

📒 Files selected for processing (1)
  • .github/workflows/bazel.yml

balajinvda and others added 2 commits July 21, 2026 09:56
The module's cmd/BUILD.bazel loads //rules/oci:defs.bzl, but its rules/oci
directory shipped with only BUILD.bazel -- defs.bzl, transition.bzl, and the
private/{common,go}.bzl helpers were missing, so bazel build //... failed with
'cannot load //rules/oci/private:go.bzl: no such file'. This never surfaced
because the module was not in the CI matrix. Copy the complete, byte-identical
rules/oci tree the sibling workers already carry.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three matrix fixes surfaced by enabling root tests and adding service rows:

- Root never warmed the remote cache: root's .bazelrc pins --config=remote,
  which sets --remote_upload_local_results=false; the workflow only overrode it
  to false for PRs and relied on the default (true) on main, so root's warm
  main-push builds silently never uploaded. Force the flag true when uploading.
- Affected-target narrowing never fired: the Determine step resolved the base as
  origin/<branch>, which is not created inside the container checkout, so it
  always fell back to //.... Diff against the PR base SHA (present via
  fetch-depth: 0) instead.
- byoo-otel-collector build needs a system go for its otelcol-contrib genrule,
  which ghcr bazel-ci:0.8.0 lacks. Bump to 0.11.0 (Go baked in, matches GitLab).

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/compute-plane-services/worker-llm-credentials/rules/oci/private/go.bzl`:
- Around line 57-84: Add repo-native coverage for the go_oci_image macro and its
_go_oci_image_impl outputs. Instantiate the macro with representative binary,
base, entrypoint, tags, and registry values, then verify generated targets for
both Linux platforms, the multi-architecture index, tar/load output, and the
optional push target; also cover the registry-omitted case to confirm push is
not generated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5a085e5f-5d48-496e-aa48-b2b408606c79

📥 Commits

Reviewing files that changed from the base of the PR and between 39e2d1c and dc4e3db.

📒 Files selected for processing (5)
  • .github/workflows/bazel.yml
  • src/compute-plane-services/worker-llm-credentials/rules/oci/defs.bzl
  • src/compute-plane-services/worker-llm-credentials/rules/oci/private/common.bzl
  • src/compute-plane-services/worker-llm-credentials/rules/oci/private/go.bzl
  • src/compute-plane-services/worker-llm-credentials/rules/oci/transition.bzl

…change

- .bazelrc: drop the unconditional 'build --config=remote'. It pinned every
  build to the internal read-only nvcfbarn cache (unreachable from GitHub) and
  forced --remote_upload_local_results=false, which is why root never warmed.
  The per-service modules bake in no cache config; the caller (CI or a dev's
  ~/.bazelrc.user) supplies the endpoint and upload policy. Root now matches.
  The remote / remote-write configs stay defined for explicit opt-in.
- Add .github/bazel-root-test-quarantine.txt to ROOT_GLOBS so a PR that edits
  only the quarantine list still runs the root row (CodeRabbit).

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.bazelrc:
- Around line 46-59: Reconcile the remote-cache policy documentation across the
`.bazelrc` comments: update the stale references around the `remote` and
`remote-write` configurations so they consistently reflect that caching is
opt-in, `remote` is read-only, and `remote-write` is permitted for the
documented internal/on-VPN workflows rather than being CI-only. Make the policy
and upload-mode guidance consistent throughout the file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 34333b2c-affd-4fda-883e-f396b81a99ad

📥 Commits

Reviewing files that changed from the base of the PR and between dc4e3db and 8f88451.

📒 Files selected for processing (2)
  • .bazelrc
  • .github/workflows/bazel.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/bazel.yml

Comment thread .bazelrc
balajinvda and others added 3 commits July 21, 2026 10:28
byoo-otel-collector's otelcol-contrib genrule shells out to a system go
(rules_go's hermetic toolchain is rejected for that collector builder). The
image now ships Go 1.25.6 (nvcf/bazel-ci-templates!4 cut the 0.12.x line with
Go), so the byoo row builds. All rows move to 0.12.2 together.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0.12.2 was a mistaken tag (not in ghcr) and broke every row on image-pull. The
real version is 0.12.0 from nvcf/bazel-ci-templates!4, now mirrored to
ghcr.io/nvidia/nvcf/bazel-ci:0.12.0. It ships Go 1.25.6 so byoo-otel-collector's
otelcol-contrib genrule builds.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
With Go now in the CI image, the otelcol-contrib genrule gets past 'cannot find
go' but fails with 'error obtaining VCS status: exit status 128': go build runs
in Bazel's sandbox where there is no .git, so default VCS stamping errors. Add
-buildvcs=false to both arch build commands. Builds on GitLab where .git is
present were unaffected; the flag is harmless there.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@balajinvda
balajinvda added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit b586308 Jul 21, 2026
31 checks passed
@balajinvda
balajinvda deleted the ci/enable-root-tests branch July 21, 2026 18:51
balajinvda added a commit that referenced this pull request Jul 21, 2026
The test was written for nv-boot-parent as a standalone workspace root, so it
resolved generate_notice.py and its metadata at ${workspace}/tools/bazel/... and
checked ${workspace}/NOTICE. In the monorepo the workspace root is the repo
root, so those files live under src/libraries/java/nv-boot-parent/tools/bazel and
the import failed (No module named 'generate_notice'); it also checked the
aggregate root NOTICE (Go+Rust+Java) with only nv-boot's Java roots, which can
never match.

Point the script at the subtree prefix and at nv-boot-parent's own NOTICE, and
swap the //:NOTICE data dep for //src/libraries/java/nv-boot-parent:NOTICE. The
Maven lock stays the single root //:maven_install.json (where the Java dep
versions live). This never ran before #311 enabled root tests.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pdmack pushed a commit to pdmack/nvcf that referenced this pull request Jul 21, 2026
…DIA#324)

The test was written for nv-boot-parent as a standalone workspace root, so it
resolved generate_notice.py and its metadata at ${workspace}/tools/bazel/... and
checked ${workspace}/NOTICE. In the monorepo the workspace root is the repo
root, so those files live under src/libraries/java/nv-boot-parent/tools/bazel and
the import failed (No module named 'generate_notice'); it also checked the
aggregate root NOTICE (Go+Rust+Java) with only nv-boot's Java roots, which can
never match.

Point the script at the subtree prefix and at nv-boot-parent's own NOTICE, and
swap the //:NOTICE data dep for //src/libraries/java/nv-boot-parent:NOTICE. The
Maven lock stays the single root //:maven_install.json (where the Java dep
versions live). This never ran before NVIDIA#311 enabled root tests.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants