ci: fix array iteration, variable leaks, and spurious full-reactor lint runs - #14227
Open
lqiu96 wants to merge 1 commit into
Open
ci: fix array iteration, variable leaks, and spurious full-reactor lint runs#14227lqiu96 wants to merge 1 commit into
lqiu96 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request optimizes and fixes issues in the Kokoro build scripts. Specifically, it skips the linter check early in .kokoro/build.sh if no relevant Java modules are affected, fixes a module assignment bug in .kokoro/common.sh, and optimizes the POM file search by using grep instead of find. The review feedback suggests making the grep pattern in find_all_poms_with_versioned_dependency more robust by allowing optional whitespace around the artifact ID to prevent silently skipping files with non-standard formatting.
lqiu96
marked this pull request as draft
September 1, 2026 16:50
lqiu96
force-pushed
the
fix-ci-bugs
branch
2 times, most recently
from
September 1, 2026 20:01
712c532 to
28ae25b
Compare
…or lint runs
- In .kokoro/common.sh (update_all_poms_dependency): fix array iteration
where `for pom in $POMS; do` only processed the first POM element. Update to
`for pom in "${POMS[@]}"`, and use pure-Bash `${pom%/*}` instead of `$(dirname "$pom")`.
- In .kokoro/common.sh (find_all_poms_with_versioned_dependency): reset POMS=(),
use local arrays, and pre-filter candidates with grep -rl before executing xmllint.
- In .kokoro/common.sh (generate_graalvm_modules_list): fix variable typo where
modules_assigned_list appended leaked ${module} instead of loop variable ${maven_module},
and parse MAVEN_MODULES using pure-Bash `IFS=, read -ra`.
- In .kokoro/build.sh: streamline changed Java module resolution into a single
while loop with guard clauses, case pattern matching for exclusions, and
cleanly skip linter checks when changed_modules is empty after exclusions
(preventing spurious full-reactor lint runs without -pl).
lqiu96
marked this pull request as ready for review
September 1, 2026 21:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several correctness bugs and edge cases in Kokoro CI build and helper scripts:
Fix Array Iteration in
update_all_poms_dependency(.kokoro/common.sh):for pom in $POMS; doonly iterated over the first element of the array.for pom in "${POMS[@]}"; do.find_all_poms_with_versioned_dependency, resetPOMS=(), scoped local arrays, and pre-filtered candidate files withgrep -rl "<artifactId>${1}</artifactId>" --include="pom.xml" .before runningxmllint.Fix Variable Leaks in
generate_graalvm_modules_list(.kokoro/common.sh):modules_assigned_list+=("${module}")appended a leaked${module}variable instead of the loop variable${maven_module}.Prevent Spurious Full-Reactor Lint Scans (
.kokoro/build.sh):has_code_change="true"was set, butchanged_moduleswas empty after exclusions.MODULE_FILTER="", causing Maven to run format/checkstyle without-placross the entire 280+ module reactor.changed_modulesis empty after exclusions, cleanly exit 0 and skip linting.Verification
bash -n .kokoro/common.sh .kokoro/build.shgit diff --checkbash .kokoro/common_test.sh