Skip to content

ci: add opt-in FAST_IT_BUILD path for integration-single jobs - #15304

Open
igorbernstein2 wants to merge 3 commits into
mainfrom
ci/kokoro-single-maven-pass
Open

igorbernstein2 wants to merge 3 commits into
mainfrom
ci/kokoro-single-maven-pass

Conversation

@igorbernstein2

@igorbernstein2 igorbernstein2 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an inert, opt-in FAST_IT_BUILD=true build path to .kokoro/build.sh (JOB_TYPE=integration-single) and supporting helpers in .kokoro/common.sh to eliminate redundant Maven compilation and reactor overhead (~1m–1m 30s per shard).

No .kokoro/*.cfg files are changed in this PR; existing CI jobs are 100% unchanged until explicitly opted in via FAST_IT_BUILD=true (following Kokoro allowed_env_vars allowlisting).

Root Causes Addressed

  1. Eliminate clirr:check forked compile lifecycles: Even though -Pquick-build sets <clirr.skip>true</clirr.skip>, clirr-maven-plugin:2.8:check declares @Execute(phase = COMPILE) and forks an extra compile pass on every module before checking <skip>. Passing -P=-clirr-compatibility-check (documented in java-shared-config/java-shared-config/pom.xml) prevents the plugin binding and forked compile entirely.
  2. Stop unconditionally building grpc-gcp-java / proto-google-cloud-spanner-v1: Extracts core_always_install_deps (without grpc-gcp-java) and adds build_upstream_deps_list / install_upstream_deps, which includes module-specific upstream dependencies via get_upstream_modules (so java-spanner and java-spanner-jdbc still install grpc-gcp-java, while unrelated libraries like java-bigtable drop grpc-gcp-java and proto-google-cloud-spanner-v1).
  3. Eliminate double/quadruple compilation of BUILD_SUBDIR:
    • install_upstream_deps installs only upstream monorepo dependencies without compiling BUILD_SUBDIR.
    • When INTEGRATION_TEST_ARGS filters modules with -pl/--projects (e.g., -pl google-cloud-bigtable), sibling submodules are pre-installed in parallel (-T 1C -Dmaven.test.skip=true) and mvn verify runs without --also-make, so main and test sources each compile once and sibling modules (such as emulator ITs on cloud shards) are skipped.
    • When INTEGRATION_TEST_ARGS does not use -pl/--projects (e.g., java-bigtable-emulator.yaml), mvn verify runs in a single reactor pass directly inside BUILD_SUBDIR.

Verification

  • bash -n .kokoro/common.sh .kokoro/build.sh .kokoro/common_test.sh passes.
  • bash .kokoro/common_test.sh passes (added unit tests test_has_maven_project_filter, test_build_upstream_deps_list, and test_install_modules_and_upstream_deps).
  • Empirically verified with Maven on java-bigtable:
    • install_upstream_deps "java-bigtable" resolves a 51-module reactor (all parents + core deps) with zero grpc-gcp-java, spanner, bigtable, or clirr executions; java-spanner includes grpc-gcp-java (54 modules).
    • Clean FAST_IT_BUILD=true run with -pl google-cloud-bigtable -P bigtable-prod-it compiles google-cloud-bigtable 1x main + 1x test (down from 4x main + 2x test), skips google-cloud-bigtable-emulator, activates failsafe (prod-it), and runs 0 clirr executions.
    • Clean FAST_IT_BUILD=true run without -pl (-P bigtable-emulator-it) builds all 10 java-bigtable submodules in a single mvn verify pass (1x main + 1x test), activates failsafe (emulator-it), and runs 0 clirr executions.

Adds an inert opt-in FAST_IT_BUILD=true code path for JOB_TYPE=integration-single
that eliminates redundant Maven work without changing default behavior:

- Extract shared core_always_install_deps in .kokoro/common.sh and add
  build_upstream_deps_list / install_upstream_deps to install only required
  monorepo upstream dependencies (including get_upstream_modules such as
  grpc-gcp-java for java-spanner / java-spanner-jdbc) without building
  BUILD_SUBDIR itself or pulling grpc-gcp-java / proto-google-cloud-spanner-v1
  into unrelated libraries.
- Pass -P=-clirr-compatibility-check to prevent clirr:check from forking a
  duplicate compile lifecycle despite -Pquick-build (<clirr.skip>true</clirr.skip>).
- When INTEGRATION_TEST_ARGS filters modules via -pl/--projects, pre-install
  BUILD_SUBDIR submodules in parallel with -Dmaven.test.skip=true so main and
  test sources compile only once, then run mvn verify without --also-make so
  sibling modules are skipped. When no -pl/--projects filter is present, run a
  single mvn verify pass directly in BUILD_SUBDIR.
- Capture mvn verify exit code with || RETURN_CODE=$? so set -e still runs
  popd, coerce_logs.sh, and flakybot.
- Add unit tests in .kokoro/common_test.sh.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fast integration test build mode (FAST_IT_BUILD) in the Kokoro build scripts, optimizing the build process by installing only the necessary upstream dependencies and skipping redundant submodule compilations when targeted project filters are used. The feedback points out a potential issue with capturing the exit code of the maven verify command using '|| RETURN_CODE=$?' under 'set -e', which can leave the variable unset or stale on success, and suggests using an if/else block instead.

Comment thread .kokoro/build.sh Resolved

@lqiu96 lqiu96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I think this looks fine. Opt-in for now to see how this works for BigTable. Hopefully this helps makes BT's ITs run faster

This branch has not been deployed

No deployments
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