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

Run build-tools test with Gradle jdk #49459

Merged
merged 4 commits into from
Nov 22, 2019

Conversation

jaymode
Copy link
Member

@jaymode jaymode commented Nov 21, 2019

The test task is configured to use the runtime java version, but there
are issues with the version of groovy used by gradle pre 6.0. In order
to workaround this, we use the Gradle JDK to execute the build-tools
tests.

Closes #49404
Closes #49253

The test task is configured to use the runtime java version, but there
are issues with the version of groovy used by gradle pre 6.0. In order
to workaround this, we use the compiler java to execute the build-tools
tests.

Closes elastic#49404
@jaymode jaymode added :Delivery/Build Build or test infrastructure >test-failure Triaged test failures from CI v8.0.0 v7.6.0 v7.5.1 labels Nov 21, 2019
@jaymode jaymode requested a review from mark-vieira November 21, 2019 18:59
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

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.

This brings up a good question, which is that we don't well define what versions of Java our build runtime is compatible with. This is mostly minimumCompilerVersion but there are exceptions here. Essentially, because we are still on Gradle 5.x, you cannot run the build with Java 13, thus it makes no sense to test build-tools against that version.

With that in mind, I think the better thing to do is simply to disable our build-tools tests entirely on those Java versions. Essentially, those matrix jobs are not applicable to build-tools, so there's no point in reconfiguring the build to test with another java version that already overlaps with another matrix build.

Let's do something like this:

tasks.withType(Test) {
  onlyIf {
    org.elasticsearch.gradle.info.BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_12
  }
}

@jaymode
Copy link
Member Author

jaymode commented Nov 21, 2019

I made the proposed change but I have a concern. In the default developer setup, tests will not be run for build-tools at all. Unless a runtime java home is specified, we default to using JDK 13 as the runtime java home (the provisioned jdk) so these tests will only run in matrix jobs if I understand correctly.

@mark-vieira
Copy link
Contributor

I made the proposed change but I have a concern. In the default developer setup, tests will not be run for build-tools at all. Unless a runtime java home is specified, we default to using JDK 13 as the runtime java home (the provisioned jdk) so these tests will only run in matrix jobs if I understand correctly.

Good point. So I'd do two things:

  1. Omit the build-tools project in the runtime-jdk-provision.gradle script altogether, as those defaults aren't applicable here.
  2. Hard code the test executable in buildSrc/build.gradle to Jvm.current().getJavaHome() so that we are always testing with the build java home, since that's what we care about.

@jaymode jaymode changed the title Run build-tools test with compiler jdk Run build-tools test with Gradle jdk Nov 22, 2019
@jaymode jaymode requested a review from mark-vieira November 22, 2019 15:04
@jaymode jaymode added >test Issues or PRs that are addressing/adding tests and removed >test-failure Triaged test failures from CI labels Nov 22, 2019
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.

LGTM 👍

@@ -223,8 +224,13 @@ if (project != rootProject) {
}
check.dependsOn(integTest)

// for now we hardcode the tests for our build to use the gradle jvm.
tasks.withType(Test).configureEach {
it.executable = Jvm.current().getJavaHome().toPath().resolve("bin").resolve("java").toAbsolutePath()
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified to Jvm.current().getJavaExecutable()

@jaymode jaymode merged commit e9941c2 into elastic:master Nov 22, 2019
@jaymode jaymode deleted the build_tools_test_compile_java branch November 22, 2019 17:13
jaymode added a commit to jaymode/elasticsearch that referenced this pull request Nov 22, 2019
The test task is configured to use the runtime java version, but there
are issues with the version of groovy used by gradle pre 6.0. In order
to workaround this, we use the Gradle JDK to execute the build-tools
tests.

Closes elastic#49404
Closes elastic#49253
jaymode added a commit that referenced this pull request Nov 22, 2019
The test task is configured to use the runtime java version, but there
are issues with the version of groovy used by gradle pre 6.0. In order
to workaround this, we use the Gradle JDK to execute the build-tools
tests.

Closes #49404
Closes #49253
jaymode added a commit that referenced this pull request Nov 22, 2019
The test task is configured to use the runtime java version, but there
are issues with the version of groovy used by gradle pre 6.0. In order
to workaround this, we use the Gradle JDK to execute the build-tools
tests.

Closes #49404
Closes #49253
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
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 >test Issues or PRs that are addressing/adding tests v7.5.1 v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoClassDefFoundError in BuildPluginTests Build Tools Test are Broken without Runtime JDK Definition
4 participants