Skip to content

Update Gradle to 9.6.1 - #22639

Open
serhiy-bzhezytskyy wants to merge 3 commits into
opensearch-project:mainfrom
serhiy-bzhezytskyy:gradle-961
Open

Update Gradle to 9.6.1#22639
serhiy-bzhezytskyy wants to merge 3 commits into
opensearch-project:mainfrom
serhiy-bzhezytskyy:gradle-961

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown

Description

Resolves #22638.

9.4.1 was set in April by #21153; 9.5.0 and 9.6.x have shipped since. The wrapper bump is two lines, but this repository sets

# Enforce the build to fail on deprecated gradle api usage
systemProp.org.gradle.warning.mode=fail

so every deprecation 9.6 introduces has to be resolved for the build to run at all. Measured on main: zero Gradle deprecations on 9.4.1, 22 on 9.6.1. Each is also scheduled to become an error in Gradle 10.

Implicit lookup of a parent project's methods and properties — 13 sites:

where change
distribution/docker taskName(...) called from the -export subprojects → this.taskName
distribution a bare libs resolved the parent's version-catalog accessor, which also collides with the libs configuration declared right above it. Now resolved explicitly as StandaloneRestTestPlugin does, off rootProject:distribution has no VersionCatalogsExtension of its own. bcFips resolves to an identical set of artifacts before and after.
buildSrc allprojects { java { ... } } reached into :build-tools:reaper, which applies the java plugin and sets the same compatibility in its own script. Wrapper dropped; both projects still compile to class file version 65 (Java 21).
distribution/docker/docker-build-context dockerBuildContext(...) is a closure on the parent's extparent.ext.dockerBuildContext.call(...)
build.gradle upstreamProject.base.archivesName — see below

Passing a Project as a dependency notation — 6 sites (JarHellPrecommitPlugin, ThirdPartyAuditPrecommitPlugin, LoggerUsagePrecommitPlugin, RestTestUtil, PluginBuildPlugin, StandaloneRestTestPlugin) → DependencyHandler.project(String), plus the two aggregation loops in build.gradle.

Project.getPropertiesqa/os/windows-2016, windows-2012r2findProperty.

MavenArtifactRepository.getArtifactUrls — deprecated with no replacement, and nothing here ever sets artifactUrls, so RepositoriesSetupPlugin was validating an always-empty collection. Removed.

Cross-project extra propertiesrepository-hdfs read krb5Conf/krb5Keytabs off the krb5kdc-fixture project's ext at configuration time, which 9.6 no longer allows. The paths are fully determined by the fixture's layout, so they are built locally.

One fix corrects a defect

The javadoc-linking code read upstreamProject.base.archivesName before the upstream project had been evaluated, so its base extension did not exist yet and the implicit lookup silently returned the parent's name: :modules:autotagging-commons:common and :spi were both linked as rule-framework, while they publish common-*.jar and autotagging-commons-spi-*.jar. Calling evaluationDependsOn first — which the neighbouring shadowed branch already does — yields the published names.

Testing

precommit and assemble green on 9.6.1 with zero deprecation warnings. :distribution:docker:buildArm64DockerImage fails in my environment because the Docker build fetches tini from github.com inside the container and my network blocks it — it fails the same way on unmodified main.

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable. (n/a)
  • Public documentation issue/PR created, if applicable. (n/a — build only)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

9.4.1 was set in April; 9.5.0 and 9.6.x have shipped since. The wrapper bump itself is
two lines, but this repository sets

  # Enforce the build to fail on deprecated gradle api usage
  systemProp.org.gradle.warning.mode=fail

so every deprecation 9.6 introduces has to be resolved for the build to run at all.
Measured on main: zero Gradle deprecations on 9.4.1, 22 on 9.6.1. Each is also scheduled
to become an error in Gradle 10, so this clears that path too.

Implicit lookup of a parent project's methods and properties (13 sites):
- distribution/docker: taskName(...) called from the -export subprojects, now this.taskName
- distribution: a bare `libs` in the subprojects block resolved the parent's version-catalog
  accessor, which also collides with the `libs` configuration declared right above it; the
  catalog is now resolved explicitly, as StandaloneRestTestPlugin does, off rootProject --
  :distribution has no VersionCatalogsExtension of its own. The bcFips configuration
  resolves to an identical set of artifacts before and after.
- buildSrc: `allprojects { java { ... } }` reached into :build-tools:reaper, which applies the
  java plugin and sets the same compatibility in its own script; the allprojects wrapper is
  dropped. Both projects still compile to class file version 65 (Java 21).
- distribution/docker/docker-build-context: dockerBuildContext(...) is a closure on the
  parent's ext, now parent.ext.dockerBuildContext.call(...)
- build.gradle: upstreamProject.base.archivesName, see below

Passing a Project as a dependency notation (6 sites): JarHellPrecommitPlugin,
ThirdPartyAuditPrecommitPlugin, LoggerUsagePrecommitPlugin, RestTestUtil, PluginBuildPlugin,
StandaloneRestTestPlugin -- all now DependencyHandler.project(String). Also the two
testReportAggregation / jacocoAggregation loops in build.gradle.

Project.getProperties (2 sites): qa/os/windows-2016 and windows-2012r2, now findProperty.

MavenArtifactRepository.getArtifactUrls: the whole feature is deprecated with no replacement,
and nothing in this repository ever sets artifactUrls, so RepositoriesSetupPlugin was
validating an always-empty collection. Removed.

Cross-project extra properties: repository-hdfs read krb5Conf/krb5Keytabs off the
krb5kdc-fixture project's ext at configuration time, which 9.6 no longer allows. The paths are
fully determined by the fixture's layout (testfixtures_shared, which is what TestFixturesPlugin
sets testFixturesDir to), so they are built locally instead.

The javadoc-linking fix also corrects a defect. That code read upstreamProject.base.archivesName
before the upstream project had been evaluated, so its base extension did not exist yet and the
implicit lookup silently returned the *parent's* name: :modules:autotagging-commons:common and
:spi were both linked as "rule-framework" while they publish common-*.jar and
autotagging-commons-spi-*.jar. Calling evaluationDependsOn first -- which the neighbouring
shadowed branch already does -- yields the published names.

precommit and assemble are green on 9.6.1 with zero deprecation warnings.
:distribution:docker:buildArm64DockerImage fails here for an unrelated reason -- the docker
build fetches tini from github.com inside the container and this network blocks it -- and it
fails the same way on unmodified main.

Signed-off-by: serhiy-bzhezytskyy <me@serhiy-bzhezytskyy.com>
@serhiy-bzhezytskyy
serhiy-bzhezytskyy requested a review from a team as a code owner August 3, 2026 08:27
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit bfd9f4a.

Hard block: Issues at Medium severity or above will block this PR from merging.

PathLineSeverityDescription
gradle/wrapper/gradle-wrapper.jar1highBinary Gradle wrapper JAR replaced. Binary build-tool artifacts are a common supply chain attack vector; the new artifact must be verified against the official Gradle 9.6.1 release checksum before merging.
gradle/wrapper/gradle-wrapper.properties4highGradle distribution URL changed to gradle-9.6.1-all.zip with a new SHA-256 hash. Per mandatory rule, any build-tool distribution change must be independently verified by maintainers to confirm the hash matches the official Gradle release.
buildSrc/src/main/java/org/opensearch/gradle/RepositoriesSetupPlugin.java71mediumThe loop that called assertRepositoryURIIsSecure() on all Maven artifactUrls has been removed. Although the comment attributes this to a Gradle 9.6 deprecation, the net effect is that per-artifact-URL security enforcement is no longer applied, which could allow an insecure artifact URL to slip through undetected if one is ever added.

The table above displays the top 10 most important findings.

Total: 3 | Critical: 0 | High: 2 | Medium: 1 | Low: 0


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

The Code-Diff-Analyzer flagged the removal as silently weakening a security invariant,
which is fair -- the reason was only in the PR text, not in the file.

Reading getArtifactUrls() warns from
DefaultMavenArtifactRepository#nagAboutArtifactUrlsDeprecation, and this build turns
Gradle deprecations into failures via org.gradle.warning.mode=fail, so the call cannot
stay. There is no non-deprecated way to read it either: the whole feature -- separate
locations for POMs and artifacts, with no Maven equivalent -- is deprecated.
@SuppressWarnings does not help, since this is a runtime nag rather than a javac warning.

Nothing is lost in practice: artifactUrls' setters are deprecated too, no repository in
this build sets them, and a build that did would already be failing on the setter.

Signed-off-by: serhiy-bzhezytskyy <me@serhiy-bzhezytskyy.com>
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Author

Both Code-Diff-Analyzer findings that are about my changes rather than about the wrapper binary:

getArtifactUrls (medium) — fair that the reason was only in the PR text. Now in the file. The call cannot stay: reading it warns from DefaultMavenArtifactRepository#nagAboutArtifactUrlsDeprecation, and this build turns Gradle deprecations into failures via org.gradle.warning.mode=fail. There is no non-deprecated way to read it — the whole feature is deprecated, with no Maven equivalent — and @SuppressWarnings does not help since this is a runtime nag, not a javac warning. Nothing is lost in practice: the setters are deprecated too, no repository here sets artifactUrls, and a build that did would already fail on the setter. Worth noting the existing // TODO: remove this with gradle 7.0, which no longer allows insecure urls right above is stale — 9.6.1 still accepts an http:// repository at configuration time, so the getUrl() check is still doing work.

minimumGradleVersion (low) — previous bumps left this file alone, so I tested whether it could stay at 9.4.1. It cannot: DependencyHandler.project(String) does not exist in 9.4.1, so the build logic in this PR fails to compile with 4 errors on that wrapper.

The two high findings are the wrapper JAR and the distribution URL/SHA256, which change on every bump by construction. Both were produced by ./gradlew wrapper --gradle-version 9.6.1, and the checksum matches https://services.gradle.org/distributions/gradle-9.6.1-all.zip.sha256 (61ba77b3ff7167e60962763eb4bae79db7120c189b9544358d0ade3c1e712a83).

@sandeshkr419 sandeshkr419 added skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis. skip-diff-reviewer Maintainer to skip code-diff-reviewer check, after reviewing issues in AI analysis. labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 92b5a7d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis. skip-diff-reviewer Maintainer to skip code-diff-reviewer check, after reviewing issues in AI analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Gradle to 9.6.1

2 participants