Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle to 8.0 #5666

Merged
merged 1 commit into from
Feb 16, 2023
Merged

Update Gradle to 8.0 #5666

merged 1 commit into from
Feb 16, 2023

Conversation

reta
Copy link
Collaborator

@reta reta commented Dec 30, 2022

Signed-off-by: Andriy Redko andriy.redko@aiven.io

Description

The first Gradle 8.0 is out, starting the draft pull request to understand required efforts for migration.

Issues Resolved

N/A

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2023

Gradle Check (Jenkins) Run Completed with:

@reta reta force-pushed the update.gradle.8 branch from 0459264 to 63de475 Compare January 9, 2023 17:49
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@dblock
Copy link
Member

dblock commented Jan 10, 2023

@reta When are you going to write a GHA and publish it on the marketplace to upgrade gradle to the latest? :) Or should dependabot do it?

@reta
Copy link
Collaborator Author

reta commented Jan 10, 2023

@reta When are you going to write a GHA and publish it on the marketplace to upgrade gradle to the latest? :) Or should dependabot do it?

@dblock Uh ... each Gradle update is a nightmare ... even minor ... :( This one is not the exception :(

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta
Copy link
Collaborator Author

reta commented Jan 11, 2023

Gradle Check (Jenkins) Run Completed with:

* **RESULT:** FAILURE x

* **URL:** https://build.ci.opensearch.org/job/gradle-check/9200/

* **CommitID:** [cb36e3b](https://github.com/opensearch-project/OpenSearch/commit/cb36e3b42b9964c467f559b1307ce32b3bcaa1e3)
  Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green.
  Is the failure [a flaky test](https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md#flaky-tests) unrelated to your change?
 jar1: /home/ubuntu/.gradle/caches/modules-2/files-2.1/junit/junit/4.13.2/8ac9e16d933b6fb43bc7f576336b8f4d7eb5ba12/junit-4.13.2.jar
        jar2: /home/ubuntu/.gradle/wrapper/dists/gradle-8.0-rc-1-all/2p8rgxxewg8l61n1p3vrzr9s8/gradle-8.0-rc-1/lib/junit-4.13.2.jar

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta reta changed the title Update Gradle to 8.0-rc-1 Update Gradle to 8.0-rc-2 Jan 17, 2023
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.cluster.service.MasterServiceTests.classMethod
      1 org.opensearch.cluster.service.MasterServiceTests.testThrottlingForMultipleTaskTypes
      1 org.opensearch.action.admin.indices.create.CreateIndexIT.testCreateAndDeleteIndexConcurrently
      1 org.opensearch.action.admin.indices.create.CreateIndexIT.classMethod

build.gradle Outdated
@@ -413,6 +427,13 @@ gradle.projectsEvaluated {
}

project.tasks.withType(Test) { task ->
// This is so hacky: now, by default, test tasks uses JUnit framework and always includes 'junit'
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused about how this comment relates to this code here. The comment has been added but no code has changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh thanks @andrross , it was initially applied in 2 places, removing that

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta reta requested a review from andrross February 14, 2023 14:03
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationStatsIT.testSegmentReplicationStatsResponse

@reta
Copy link
Collaborator Author

reta commented Feb 16, 2023

@dblock @andrross mind taking a look folks? thanks!

// jar1: /home/ubuntu/.gradle/caches/modules-2/files-2.1/junit/junit/4.13.2/8ac9e16d933b6fb43bc7f576336b8f4d7eb5ba12/junit-4.13.2.jar
// jar2: /home/ubuntu/.gradle/wrapper/dists/gradle-8.0-rc-1-all/2p8rgxxewg8l61n1p3vrzr9s8/gradle-8.0-rc-1/lib/junit-4.13.2.jar
//
task.getTestFrameworkProperty().convention(getProviderFactory().provider(() -> new JUnitTestFramework(task, task.getFilter(), false)));
Copy link
Member

Choose a reason for hiding this comment

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

I understand the problem here (gradle includes JUnit by default resulting in a duplicate JAR on the classpath). But how does code solve it? I obviously don't know gradle very well...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But how does code solve it?

You see the last option in the JUnitTestFramework constructor - false - it literally says "do not include the JUnit dependencies" [1]

[1] https://github.com/gradle/gradle/blob/master/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java#L44

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Thanks! One of Nick's cryptic booleans :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it was possible to control this behaviour with a property - but not anymore with Gradle 8

.invokeExact((BuildServiceProvider<TestClustersThrottle, ?>) throttleProvider);
}
} catch (Throwable ex) {
throw new IllegalStateException("Unable to find suitable BuildServiceRegistryInternal::getResourceLock", ex);
Copy link
Member

Choose a reason for hiding this comment

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

Copy/paste error on "getResourceLock" in exception message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh.... thanks :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

) {
try {
try {
// The forService(Provider) is used by Gradle pre-8.0
Copy link
Member

Choose a reason for hiding this comment

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

When does this code ever need to run against Gradle pre-8.0 after this change?

Copy link
Collaborator Author

@reta reta Feb 16, 2023

Choose a reason for hiding this comment

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

It will run every time the build will be performed by pre - Gradle 8, best examples - plugins. OpenSearch plugins support is extensively using Gradle plugins, if the plugin uses fe Gradle 7.6 (which at this moment is applicable to any other plugin outside core), the build will fail right away.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, thanks!

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@andrross
Copy link
Member

@reta Can we backport this to 2.x?

@reta
Copy link
Collaborator Author

reta commented Feb 16, 2023

@reta Can we backport this to 2.x?

Yeah, will do, thanks @andrross ! Should be no issues

@andrross andrross added the backport 2.x Backport to 2.x branch label Feb 16, 2023
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.cluster.allocation.AwarenessAllocationIT.testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness

@reta reta merged commit 7914c04 into opensearch-project:main Feb 16, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-5666-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7914c0499048793b55aa7d4d2c1156293e7998be
# Push it to GitHub
git push --set-upstream origin backport/backport-5666-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-5666-to-2.x.

reta added a commit to reta/OpenSearch that referenced this pull request Feb 16, 2023
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit 7914c04)
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
andrross pushed a commit that referenced this pull request Feb 16, 2023
(cherry picked from commit 7914c04)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants