You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bfff55a
Browse filesBrowse the repository at this point in the historyBrowse files
perf(ci): replace mvn help:evaluate and redundant subprocesses with native bash, sed, and git optimizations
This PR is part 2 of 2 in a stacked series:
1. #14217: fix: avoid running split ITs unexpectedly on unrelated changes (#12029)
2. This PR: perf(ci): replace mvn help:evaluate with native bash and sed extraction
In Kokoro CI and automation scripts, heavy subprocesses and JVM invocations were used:
- In generate_modified_modules_list (.kokoro/common.sh), evaluating
project.modules launched a full JVM and evaluated the monorepo POMs,
taking 20–30+ seconds on every single CI run.
- In downstream-build.sh (.kokoro/presubmit/downstream-build.sh) and
showcase-native.sh (sdk-platform-java/.kokoro/presubmit/showcase-native.sh),
evaluating gapic-showcase.version launched Maven JVM processes.
- In check_status.sh (java-cloud-bom/tests/release-repository-readiness/check_status.sh),
mvn help:evaluate was called for shared dependencies and generator versions,
and table formatting piped echo into awk.
- In update_javadoc.sh (google-auth-library-java/scripts/update_javadoc.sh),
maven-help-plugin:evaluate was called to obtain the project version.
- In update_googleapis_commit.sh (sdk-platform-java/.github/scripts/update_googleapis_commit.sh),
a full git clone of googleapis was performed just to inspect HEAD commitish.
- In downstream-protobuf-binary-compatibility.sh (sdk-platform-java/.kokoro/nightly/downstream-protobuf-binary-compatibility.sh),
cat/grep/cut was run on versions.txt on every loop iteration.
- In check_existing_release_versions.sh (generation/check_existing_release_versions.sh),
xmllint was run 3 separate times per POM.
Optimizations:
- Pure-Bash Module Extraction: Updated generate_modified_modules_list to use
extract_pom_modules pom.xml, extracting all 270 modules in ~0.02s without JVM
boot overhead.
- Sed Showcase Version Extraction: Updated downstream-build.sh and showcase-native.sh
to parse <gapic-showcase.version> directly using sed with fail-fast validation,
and added --fail to curl.
- XML Tag Extraction & Printf Formatting: Updated check_status.sh to extract XML tags
directly with sed and replaced pipe-to-awk with built-in printf formatting.
- Sed Javadoc Version Extraction: Updated update_javadoc.sh to parse project version
from pom.xml using sed.
- Git Ls-Remote: Updated update_googleapis_commit.sh to query HEAD commit using
git ls-remote instead of cloning the repository.
- Associative Array Pre-caching: Pre-cached versions.txt into declare -A versions_map
in downstream-protobuf-binary-compatibility.sh instead of invoking cat/grep/cut per artifact.
- Combined XPath Query: Combined 3 xmllint calls into a single concat() XPath extraction
in check_existing_release_versions.sh.
- Unit Tests: Verified existing unit tests in .kokoro/common_test.sh and ran bash -n
and git diff --check across all modified scripts.
- Refactoring & Best Practices: Scoped temporary variables as local, used pure-bash
whitespace trimming and string manipulations, and anchored relative paths.
0 commit comments