build: stop using bazel_collect in coverage jobs#67634
build: stop using bazel_collect in coverage jobs#67634ti-chi-bot[bot] merged 4 commits intopingcap:masterfrom
Conversation
📝 WalkthroughWalkthroughThree Jenkins build scripts were changed to install Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build/jenkins_collect_coverage.sh`:
- Around line 32-36: The fallback branch in build/jenkins_collect_coverage.sh
currently creates a zero-byte placeholder for "${junit_report}" (variable
junit_report) which yields malformed JUnit XML; replace the no-op redirection (:
> test_coverage/bazel.xml) with code that writes a minimal valid JUnit document
(e.g. an empty <testsuite> root with required attributes) into
test_coverage/bazel.xml and keep the warning to stderr; apply the same change to
any sibling scripts that use the same fallback so downstream JUnit parsers
receive a valid XML file instead of a zero-byte 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c9bc55df-aa8d-4163-bce7-2826bf7cfd62
📒 Files selected for processing (3)
build/jenkins_collect_coverage.shbuild/jenkins_unit_test.shbuild/jenkins_unit_test_ddlargsv1.sh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #67634 +/- ##
================================================
- Coverage 77.5948% 77.4185% -0.1763%
================================================
Files 1981 1965 -16
Lines 547950 547963 +13
================================================
- Hits 425181 424225 -956
- Misses 121959 123736 +1777
+ Partials 810 2 -808
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
♻️ Duplicate comments (2)
build/jenkins_unit_test_ddlargsv1.sh (1)
35-39:⚠️ Potential issue | 🟠 MajorUse a valid empty JUnit fallback instead of skipping artifact creation.
This branch has the same stale/missing artifact risk as the coverage collector script. Please emit a minimal
test_coverage/bazel.xmlwhen source JUnit is absent.🩹 Proposed fix
if [ -f "${junit_report}" ]; then mv "${junit_report}" test_coverage/bazel.xml else - echo "warning: junit report ${junit_report} not found, skipping junit artifact collection" >&2 + cat > test_coverage/bazel.xml <<'EOF' +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="bazel" tests="0" failures="0" errors="0" skipped="0"/> +EOF + echo "warning: junit report ${junit_report} not found, created empty test_coverage/bazel.xml" >&2 fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build/jenkins_unit_test_ddlargsv1.sh` around lines 35 - 39, When ${junit_report} is missing, create the test_coverage directory if needed and emit a minimal valid JUnit XML at test_coverage/bazel.xml instead of skipping; update the else branch to mkdir -p test_coverage and write a small XML like a <testsuites>/<testsuite> wrapper with tests="0" failures="0" and a timestamp or placeholder to ensure CI consumers treat it as a valid artifact (reference ${junit_report} and test_coverage/bazel.xml in your change).build/jenkins_collect_coverage.sh (1)
32-36:⚠️ Potential issue | 🟠 MajorAlways materialize
test_coverage/bazel.xmlwhen JUnit is missing.At
Line 35, skipping creation can leave staletest_coverage/bazel.xmlfrom previous workspace runs and can still break report consumers expecting this artifact. Write a minimal valid empty JUnit XML instead of skipping.🩹 Proposed fix
if [ -f "${junit_report}" ]; then mv "${junit_report}" test_coverage/bazel.xml else - echo "warning: junit report ${junit_report} not found, skipping junit artifact collection" >&2 + cat > test_coverage/bazel.xml <<'EOF' +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="bazel" tests="0" failures="0" errors="0" skipped="0"/> +EOF + echo "warning: junit report ${junit_report} not found, created empty test_coverage/bazel.xml" >&2 fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build/jenkins_collect_coverage.sh` around lines 32 - 36, The script currently skips creating test_coverage/bazel.xml when ${junit_report} is missing, which leaves stale artifacts; update the else branch in jenkins_collect_coverage.sh to always materialize a minimal valid JUnit XML at test_coverage/bazel.xml (ensure the test_coverage directory exists using mkdir -p) and write a simple empty test-suite XML (with root <testsuites> or <testsuite> and zero tests) to that path so consumers always find a well-formed file even when ${junit_report} is absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@build/jenkins_collect_coverage.sh`:
- Around line 32-36: The script currently skips creating test_coverage/bazel.xml
when ${junit_report} is missing, which leaves stale artifacts; update the else
branch in jenkins_collect_coverage.sh to always materialize a minimal valid
JUnit XML at test_coverage/bazel.xml (ensure the test_coverage directory exists
using mkdir -p) and write a simple empty test-suite XML (with root <testsuites>
or <testsuite> and zero tests) to that path so consumers always find a
well-formed file even when ${junit_report} is absent.
In `@build/jenkins_unit_test_ddlargsv1.sh`:
- Around line 35-39: When ${junit_report} is missing, create the test_coverage
directory if needed and emit a minimal valid JUnit XML at
test_coverage/bazel.xml instead of skipping; update the else branch to mkdir -p
test_coverage and write a small XML like a <testsuites>/<testsuite> wrapper with
tests="0" failures="0" and a timestamp or placeholder to ensure CI consumers
treat it as a valid artifact (reference ${junit_report} and
test_coverage/bazel.xml in your change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b9006bf8-f9c8-42eb-b127-14190acee288
📒 Files selected for processing (3)
build/jenkins_collect_coverage.shbuild/jenkins_unit_test.shbuild/jenkins_unit_test_ddlargsv1.sh
🚧 Files skipped from review as they are similar to previous changes (1)
- build/jenkins_unit_test.sh
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
build/jenkins_unit_test.sh (2)
26-26:⚠️ Potential issue | 🟠 MajorSame unused floating install here should be removed.
Line 26 has the same unused
go install ...@latestrisk as the collector script.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build/jenkins_unit_test.sh` at line 26, Remove the unused floating Go install command "go install github.com/hawkingrei/bazel_collect@latest" from the script; locate the occurrence of that exact install invocation in the jenkins_unit_test.sh script and delete it (or replace it with a proper explicit dependency installation step tied to a variable or build target if needed) so there are no stray `@latest` installs left.
37-41:⚠️ Potential issue | 🟠 MajorJUnit missing-file fallback should create a minimal XML artifact.
Same fallback gap as the sibling script: skipping file creation can still cause downstream junit collection failures.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build/jenkins_unit_test.sh` around lines 37 - 41, The script currently skips creating a JUnit artifact when the ${junit_report} file is missing; change the else branch to write a minimal valid JUnit XML to test_coverage/bazel.xml so downstream collectors always find a file. In the else branch, create the test_coverage directory if needed and write a small XML skeleton (e.g., empty <testsuites> or a single <testsuite> with zero tests) to test_coverage/bazel.xml, and keep the warning message — this ensures consumers that expect test_coverage/bazel.xml won't fail when ${junit_report} is absent.build/jenkins_collect_coverage.sh (1)
34-38:⚠️ Potential issue | 🟠 MajorFallback should still emit a valid JUnit artifact file.
When
bazel.xmlis missing, this now only logs and skips artifact creation. That can still break downstream steps expectingtest_coverage/bazel.xmlto exist. Please write a minimal valid empty JUnit XML instead.🩹 Proposed fix
if [ -f "${junit_report}" ]; then mv "${junit_report}" test_coverage/bazel.xml else - echo "warning: junit report ${junit_report} not found, skipping junit artifact collection" >&2 + cat > test_coverage/bazel.xml <<'EOF' +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="bazel" tests="0" failures="0" errors="0" skipped="0"/> +EOF + echo "warning: junit report ${junit_report} not found, created empty test_coverage/bazel.xml" >&2 fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build/jenkins_collect_coverage.sh` around lines 34 - 38, When ${junit_report} is missing the script currently only logs and skips creating test_coverage/bazel.xml; instead ensure the directory exists and write a minimal valid JUnit XML to test_coverage/bazel.xml so downstream steps always find a JUnit artifact. Modify the else branch to mkdir -p test_coverage and create a small XML file (e.g. with an XML prolog and an empty <testsuites> or a <testsuite name="empty" tests="0" failures="0"/> element) into test_coverage/bazel.xml, while still emitting the existing warning to stderr using the same message.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build/jenkins_collect_coverage.sh`:
- Line 26: Remove the unused "go install
github.com/hawkingrei/bazel_collect@latest" invocation from the script; locate
the literal install line in build/jenkins_collect_coverage.sh, delete it, and
ensure there are no other references or invocations of bazel_collect in the
script (if any exist, either remove them or add a justified, pinned installation
and invocation), so CI no longer pulls this external dependency with a floating
version.
---
Duplicate comments:
In `@build/jenkins_collect_coverage.sh`:
- Around line 34-38: When ${junit_report} is missing the script currently only
logs and skips creating test_coverage/bazel.xml; instead ensure the directory
exists and write a minimal valid JUnit XML to test_coverage/bazel.xml so
downstream steps always find a JUnit artifact. Modify the else branch to mkdir
-p test_coverage and create a small XML file (e.g. with an XML prolog and an
empty <testsuites> or a <testsuite name="empty" tests="0" failures="0"/>
element) into test_coverage/bazel.xml, while still emitting the existing warning
to stderr using the same message.
In `@build/jenkins_unit_test.sh`:
- Line 26: Remove the unused floating Go install command "go install
github.com/hawkingrei/bazel_collect@latest" from the script; locate the
occurrence of that exact install invocation in the jenkins_unit_test.sh script
and delete it (or replace it with a proper explicit dependency installation step
tied to a variable or build target if needed) so there are no stray `@latest`
installs left.
- Around line 37-41: The script currently skips creating a JUnit artifact when
the ${junit_report} file is missing; change the else branch to write a minimal
valid JUnit XML to test_coverage/bazel.xml so downstream collectors always find
a file. In the else branch, create the test_coverage directory if needed and
write a small XML skeleton (e.g., empty <testsuites> or a single <testsuite>
with zero tests) to test_coverage/bazel.xml, and keep the warning message — this
ensures consumers that expect test_coverage/bazel.xml won't fail when
${junit_report} is absent.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0be426e1-51f6-4f63-83bd-c5fda6a29839
📒 Files selected for processing (3)
build/jenkins_collect_coverage.shbuild/jenkins_unit_test.shbuild/jenkins_unit_test_ddlargsv1.sh
🚧 Files skipped from review as they are similar to previous changes (1)
- build/jenkins_unit_test_ddlargsv1.sh
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, Defined2014 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: N/A
Problem Summary:
Coverage jobs assume Bazel artifacts are always present. When coverage execution fails early,
_coverage_report.datandbazel.xmlmay be missing, which causes a secondary failure during artifact collection and can hide the original test failure.What changed and how does it work?
bazel_collectin the Jenkins coverage helper scripts../bazel-out/_coverage/_coverage_report.datdirectly when it exists.coverage.datwith a warning when the Bazel coverage report is absent.bazel.xmlintotest_coverage/when it exists.test_coverage/bazel.xmlwith a warning when the junit report is absent.make bazel_coverage_test*in the unit-test scripts.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
Bug Fixes
Chores