From e287427a039246e8dcc79a83314251ed3eb0c76f Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 12 Dec 2019 14:52:36 -0800 Subject: [PATCH] Don't pass OPENSHIFT_IP env variable when building old BWC branches (#50153) This commit tweaks the workaround introduced in #49211 to support Gradle 6.0. In the workaround, we specifically override the address the Gradle daemon binds to by passing the desired address via the OPENSHIFT_IP environment variable. This works fine for builds using Gradle 6.0, but for older Gradle versions this causes issues with inter-daemon communication, specifically when we build BWC branches not on Gradle 6.0. The fix here is to strip that environment variable out when building the target BWC branch if that branch is on an older Gradle version. This is all temporary and will be removed when this bug fix is released in Gradle 6.1. Closes #50025 --- distribution/bwc/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/distribution/bwc/build.gradle b/distribution/bwc/build.gradle index e96ee75ae43..dca0d18ac4a 100644 --- a/distribution/bwc/build.gradle +++ b/distribution/bwc/build.gradle @@ -23,6 +23,7 @@ import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.BwcVersions import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin +import org.gradle.util.GradleVersion import java.nio.charset.StandardCharsets @@ -161,6 +162,12 @@ bwcVersions.forPreviousUnreleased { BwcVersions.UnreleasedVersionInfo unreleased spoolOutput = true workingDir = checkoutDir doFirst { + // TODO: Remove this once we've updated to Gradle 6.1 + // Workaround for https://github.com/gradle/gradle/issues/11426 + if (GradleVersion.version(file("${ checkoutDir}/buildSrc/src/main/resources/minimumGradleVersion").text) != GradleVersion.current()) { + environment = environment.findAll { key, val -> key != 'OPENSHIFT_IP' } + } + // Execution time so that the checkouts are available List lines = file("${checkoutDir}/.ci/java-versions.properties").readLines() environment(