From 7a78ac73058344df5a201d589a17bec27af7a852 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Wed, 7 Oct 2026 15:58:54 -0400 Subject: [PATCH 1/2] Reduce Gradle build and test log spam in Java CI workflows - Remove `'passed'` from default `testLogging` events in `BeamModulePlugin` so only skipped/failed tests and per-task summaries are logged. - Downgrade the CI Maven Central mirror log message from `lifecycle` to `debug` in `Repositories.groovy` and `settings.gradle.kts` to avoid repeating it for every subproject. - Remove `showStandardStreams = true` and `outputs.upToDateWhen {false}` overrides from `needsRunnerTests` and `examplesIntegrationTest` in `:runners:direct-java`, `:sdks:java:io:debezium` --- .../org/apache/beam/gradle/BeamModulePlugin.groovy | 11 +++-------- .../groovy/org/apache/beam/gradle/Repositories.groovy | 2 +- runners/direct-java/build.gradle | 7 ------- sdks/java/io/debezium/build.gradle | 6 ------ settings.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 023b6dbec477..c9b764e456cd 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1265,15 +1265,10 @@ class BeamModulePlugin implements Plugin { if (System.getProperty("os.name").toLowerCase().contains("windows")) { systemProperty 'org.xerial.snappy.tempdir', System.getProperty('org.xerial.snappy.tempdir') ?: "${project.rootDir.absolutePath}/build/snappy_bin" } - // Report each test as it runs, plus a per-task summary. Gradle logs only - // failures by default, so a passing run prints nothing but "BUILD SUCCESSFUL" - // and gives no indication of which tests --tests actually selected. - // Test stdout/stderr stays off unless asked for, since it is noisy: - // -PshowTestOutput also forward test stdout/stderr - // A cached or up-to-date test task forks no JVM and prints nothing; - // add --no-build-cache --rerun to force real execution. + // Log skipped and failed tests, plus a per-task summary. + // Pass -PshowTestOutput to also forward test stdout/stderr. testLogging { - events 'passed', 'skipped', 'failed' + events 'skipped', 'failed' exceptionFormat = 'full' showExceptions = true showCauses = true diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/Repositories.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/Repositories.groovy index e154fc6ea7ac..a8d66f4ff4ed 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/Repositories.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/Repositories.groovy @@ -27,7 +27,7 @@ class Repositories { def useMirror = isCi && mirrorUrl if (useMirror) { - project.logger.lifecycle("Running in CI. Mirroring Maven Central repositories via Google Maven Mirror.") + project.logger.debug("Running in CI. Mirroring Maven Central repositories via Google Maven Mirror.") } project.repositories { diff --git a/runners/direct-java/build.gradle b/runners/direct-java/build.gradle index 547f49ce910c..96a0218e60d3 100644 --- a/runners/direct-java/build.gradle +++ b/runners/direct-java/build.gradle @@ -121,7 +121,6 @@ task needsRunnerTests(type: Test) { description = "Runs tests that require a runner to validate that pipelines/transforms work correctly" maxParallelForks 4 - testLogging.showStandardStreams = true String[] pipelineOptions = ["--runner=DirectRunner", "--runnerDeterminedSharding=false"] systemProperty "beamTestPipelineOptions", pipelineOptionsStringCrossPlatformHandling(pipelineOptions) @@ -148,10 +147,6 @@ task needsRunnerTests(type: Test) { excludeCategories "org.apache.beam.sdk.testing.UsesExternalService" excludeCategories 'org.apache.beam.sdk.testing.UsesBundleFinalizer' } - testLogging { - outputs.upToDateWhen {false} - showStandardStreams = true - } } // NOTE: This will also run 'NeedsRunner' tests, which are run in the :needsRunnerTests task as well. @@ -223,8 +218,6 @@ createJavaExamplesArchetypeValidationTask(type: 'MobileGaming', task examplesIntegrationTest(type: Test) { description = "Runs examples tests on DirectRunner" - testLogging.showStandardStreams = true - String[] pipelineOptions = [ "--runner=DirectRunner", "--runnerDeterminedSharding=false", diff --git a/sdks/java/io/debezium/build.gradle b/sdks/java/io/debezium/build.gradle index ad5410b37dee..4dbab262734c 100644 --- a/sdks/java/io/debezium/build.gradle +++ b/sdks/java/io/debezium/build.gradle @@ -113,13 +113,7 @@ def configureTestJvmArgs(Task task) { } test { - testLogging { - outputs.upToDateWhen {false} - showStandardStreams = true - exceptionFormat = 'full' - } configureTestJvmArgs(delegate) - } task integrationTest(type: Test, dependsOn: processTestResources) { diff --git a/settings.gradle.kts b/settings.gradle.kts index 2681148095d6..ffbe40365c18 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,7 +23,7 @@ pluginManagement { val useMirror = isCi && !mavenCentralMirrorUrl.isNullOrBlank() if (useMirror) { - logger.lifecycle("Running in CI. Mirroring Maven Central repositories via Google Maven Mirror.") + logger.debug("Running in CI. Mirroring Maven Central repositories via Google Maven Mirror.") } repositories { From 3b6c9a97bfc2731b64856e79c0195c04a3ed2216 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Wed, 7 Oct 2026 19:04:18 -0400 Subject: [PATCH 2/2] Address comments --- .../groovy/org/apache/beam/gradle/BeamModulePlugin.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index c9b764e456cd..554ceb625061 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1267,8 +1267,12 @@ class BeamModulePlugin implements Plugin { } // Log skipped and failed tests, plus a per-task summary. // Pass -PshowTestOutput to also forward test stdout/stderr. + // Pass -PshowTestPassed to also log passed tests. testLogging { events 'skipped', 'failed' + if (project.hasProperty('showTestPassed')) { + events 'passed' + } exceptionFormat = 'full' showExceptions = true showCauses = true