Skip to content

Update build to use gradle wrapper 6.8 #65596

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

Merged
merged 18 commits into from
Jan 12, 2021

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Nov 30, 2020

  • Updates our build to use the latest Gradle 6.8 release which is the last release before the major 7.0 release
  • Resolve available gradle versions using built-in toolchain support
  • Fixes deprecated usage of JavaInstallationRegistry
  • We replace jdk handling in our build to rely on jvm detection provided by the gradle build tool itself. As we rely on environment variables pointing to jdks we wire this into the gradle jdk detection mechanism

@breskeby breskeby self-assigned this Nov 30, 2020
@breskeby breskeby added :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.11.0 v8.0.0 labels Nov 30, 2020
@breskeby breskeby force-pushed the update-gradle-to-6-8 branch from 8a7687d to c26b3cb Compare December 1, 2020 11:36
@breskeby
Copy link
Contributor Author

breskeby commented Dec 1, 2020

Raised gradle/gradle#15392 at gradle to handle the windows issues we see

@breskeby
Copy link
Contributor Author

breskeby commented Dec 2, 2020

@elasticmachine test this please

@breskeby breskeby force-pushed the update-gradle-to-6-8 branch from b4a4e3b to 52a70d8 Compare December 4, 2020 12:06
@breskeby breskeby force-pushed the update-gradle-to-6-8 branch from c0dcdc3 to c654b22 Compare December 21, 2020 08:55
project.getTasks().findByName("generateNotice")
);
}
}
Copy link
Contributor Author

@breskeby breskeby Dec 21, 2020

Choose a reason for hiding this comment

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

This test class is not working in a unit test context anymore. The only non ignored test checked for the existence of the registered extension. Thats not enough for me to have this ported to an integ tests at the moment so I removed the unit test.

@breskeby breskeby force-pushed the update-gradle-to-6-8 branch from 456edfd to 295be18 Compare January 6, 2021 08:06
@breskeby breskeby added v7.12.0 and removed v7.11.0 labels Jan 11, 2021
@breskeby breskeby marked this pull request as ready for review January 11, 2021 08:10
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@breskeby
Copy link
Contributor Author

Raised gradle/gradle#15392 at gradle to handle the windows issues we see

That has been fixed in Gradle 6.8-rc-3

@breskeby
Copy link
Contributor Author

@elasticmachine test this please

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

Few comments, otherwise LGTM.

* We resolve all available java versions using auto detected by gradles tool chain
* To make transition more reliable we only take env var provided installations into account for now
*/
private List<JavaHome> getAvailableJavaVersions() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The bit we lose here is that we no longer enorce that the environment variable name matches the JDK version it points at. I guess this would later fail w/ us not being able to resovle a compatible JDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. is that something you think is worth to invest in? I guess those issues are rare, but when they occur they suck to be debugged I can imagine. Maybe we want to look into this safety net in a follow up?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think realistically what we want to do is remove the reliance on these environment variables and use Gradle's toolchain capabilities to just download a compatible JDK when necessary. These variables are only used for build time purposes, where we intend to run tests with a particular JDK implementation, that's what RUNTIME_JAVA_HOME is for.

So I think we can punt here and instead focus on ditching all usages of these things vs resolving JDKs dynamically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will look into this in a separate PR. I didn't want to make too many changes in this PR. So RUNTIME_JAVA_HOME is basically used to configure the jdk on CI to run all tests against?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem I see at the moment is that the compatibility choices (which vendor is available etc.) is limited in gradle at the moment and might not be enough. If you say that's less of an issue for build time then the toolchain capabilities in gradle might be enough at the moment to pick a proper one

@@ -60,6 +63,10 @@ abstract class AbstractGradleFuncTest extends Specification {
true
}

def assertOutputContainsNot(String givenOutput, String expected) {
Copy link
Contributor

Choose a reason for hiding this comment

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

assertOutputDoesNotContain or assertOutputMissing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks. assertOutputMissing it is

@@ -105,7 +105,9 @@ private void runInsecureArtifactRepositoryTest(final String name, final String u
.withProjectDir(tmpDir.getRoot())
.withArguments("clean", "hello", "-s", "-i", "--warning-mode=all", "--scan")
.withPluginClasspath()
.forwardOutput()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep this here or was this only for testing? I'm ok with keeping this around across the board BTW.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should keep it.

@@ -32,6 +32,9 @@
public TaskProvider<? extends Task> createTask(Project project) {
Configuration jarHellConfig = project.getConfigurations().create("jarHell");
if (BuildParams.isInternal() && project.getPath().equals(":libs:elasticsearch-core") == false) {
// ideally we would configure this as a default dependency. But Default dependencies do not work correctly
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's fine anyway as we don't expect this to be replaced.

Copy link
Contributor

Choose a reason for hiding this comment

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

Other question though. How does this work for external builds? Where does the jarhell implementation come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You would need to add a dependency like `jarHell 'org.elasticsearch:elasticsearch-core:7.10' at the moment. In general I think we need to put some more dedicated effort into making these external available plugins work nicely for contributors. By that I mean having proper test coverage of third party plugin author use cases etc. I remember we talked about that very early on when having our first talks about the elastic build already.
We're moving in that direction with having internal plugins nowadays but there's more work required here

- resolve available gradle versions using built-in toolchain support
- fixes deprecated usage of JavaInstallationRegistry
- with gradle 6.8 artifact transforms output is kept in build cache
- therefore there is no skipping info seen in our tests
@breskeby breskeby force-pushed the update-gradle-to-6-8 branch from f717ed4 to 77dbe62 Compare January 12, 2021 09:42
@breskeby breskeby merged commit a8757f9 into elastic:master Jan 12, 2021
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Jan 15, 2021
- Updates our build to use the latest Gradle 6.8 release which is the last release 
before the major 7.0 release. 
- Resolve available gradle versions using built-in toolchain support
- Fixes deprecated usage of JavaInstallationRegistry
- We replace jdk handling in our build to rely on jvm detection provided by the gradle build tool itself. 
As we rely on environment variables pointing to jdks we wire this into the gradle jdk detection mechanism
@breskeby breskeby deleted the update-gradle-to-6-8 branch January 18, 2021 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants