Improve isolation for nested Gradle runs#11564
Improve isolation for nested Gradle runs#11564gh-worker-dd-mergequeue-cf854d[bot] merged 8 commits into
Conversation
Gradle 9.1.0 introduced the colored console mode for color highlighting in plain logs without rich progress bars: https://docs.gradle.org/9.1.0/release-notes.html#plain-console-with-colors Use that mode through GRADLE_OPTS so GitLab jobs can render ANSI color while keeping the existing JVM argument configuration.
Keep --console=colored as an explicit argument for direct GitLab Gradle invocations instead of putting org.gradle.console in GRADLE_OPTS. Nested smoke-test application builds run through the Gradle Tooling API with Gradle 8.14.5, where the colored console value is not valid and fails before the nested build can run.
Nested smoke-test application builds run through the Gradle Tooling API and can otherwise inherit CI launcher variables from the outer build. Clear GRADLE_OPTS and GRADLE_ARGS by default before starting the nested Gradle build, while still allowing explicit smokeTestApp environment overrides.
Inline the GitLab colored console flag as --console=colored and keep it out of Gradle properties. Clear GRADLE_OPTS and GRADLE_ARGS for GradleRunner and wrapper helper invocations so nested Gradle builds do not inherit incompatible CI launcher settings.
Run nested smoke-test application builds with a task-local Gradle user home and delete it after the Tooling API build finishes. This prevents inherited CI Gradle user-home state from leaking into pinned nested Gradle versions alongside GRADLE_OPTS and GRADLE_ARGS.
Write org.gradle.console=colored into the CI-generated root gradle.properties instead of passing --console=colored on Gradle command lines. Keep the nested smoke-test GradleRunner regression focused on clearing inherited launcher arguments without using the console flag as the sentinel.
Stop the nested Gradle daemon with the downloaded Gradle distribution before deleting the task-local Gradle user home. Also configure colored console output for the test-published-dependencies Gradle root.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
This comment has been minimized.
This comment has been minimized.
Clear inherited Gradle user-home state from TestKit and build-logic smoke runs, and align the Gradle plugin smoke fixture expectations after adding the sanitized environment.
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
The expected merge time in
|
What Does This Do
Isolates nested Gradle invocations used by smoke-test application builds and Gradle TestKit fixtures from CI-provided Gradle launcher environment variables.
The main changes are:
GRADLE_OPTSandGRADLE_ARGSbefore nested Tooling API and TestKit Gradle builds run.GRADLE_USER_HOME, stop nested Gradle daemons, and delete that user home after the build.Motivation
GitLab CI exports Gradle launcher settings for the root Gradle 9 build. Those settings can be inherited by nested Gradle builds launched through the Tooling API or Gradle TestKit, including smoke-test applications pinned to older Gradle versions. That inheritance caused nested Gradle 8.14.5 builds to reject unsupported console settings before the application build could run.
The fix keeps nested builds isolated from root-build launcher state while preserving the CI root build behavior.
Additional Notes
Colored output uses Gradle's colored plain-console support introduced in Gradle 9.1.0 (
--console=colored):At this time, I chose not to clear these variables as they are not explicitly set in the gitlab ci at this time.
Nor do I choose to filter on
ORG_GRADLE_PROJECT_because some are intentionnaly needed in the nested build, in particular for therepositories.gradlescript plugin.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issue/merge.Jira ticket: [PROJ-IDENT]