Skip to content

Commit 46b91f5

Browse files
authored
Revert "Leverage artifact transformations to unpack old test es distributions (#79827)" (#79909)
This reverts commit 664b821. This might have caused oldEs090Fixture failures (see #79898) We have not been able to reproduce the problem nor locally or on an centos8 We will revisit this advancement once we narrowed down the reasoning of those failures
1 parent ec05952 commit 46b91f5

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

modules/reindex/build.gradle

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import org.elasticsearch.gradle.Architecture
1111
import org.elasticsearch.gradle.OS
1212
import org.elasticsearch.gradle.internal.info.BuildParams
1313
import org.elasticsearch.gradle.internal.test.AntFixture
14-
import org.elasticsearch.gradle.transform.UnzipTransform
15-
import org.gradle.api.internal.artifacts.ArtifactAttributes
1614

1715
apply plugin: 'elasticsearch.test-with-dependencies'
1816
apply plugin: 'elasticsearch.jdk-download'
@@ -104,28 +102,30 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
104102
systemProperty "tests.fromOld", "false"
105103
}
106104
} else {
107-
/* Register a gradle artifact transformation to unpack resolved elasticsearch distributions. We only resolve
108-
* zip files here. Using artifact transforms allow a better caching of the downloaded distros as the
109-
* transformed (unpacked) distro will be cached by gradle resulting in less unpacking
110-
*
111-
* To avoid testing against too many old versions, always pick first and last version per major
112-
*/
113-
project.getDependencies().registerTransform(UnzipTransform.class, transformSpec -> {
114-
transformSpec.getFrom().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.ZIP_TYPE);
115-
transformSpec.getTo().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
116-
});
117-
105+
/* Set up tasks to unzip and run the old versions of ES before running the
106+
* integration tests. */
118107
def versions = ['2', '1', '090']
119108
if (Os.isFamily(Os.FAMILY_MAC)) {
120109
// 0.90 fails sometimes on mac, given that it is so old, let us disable it
121110
// see: https://github.com/elastic/elasticsearch/issues/51202
122111
versions = ['2', '1']
123112
}
124113
versions.each { version ->
125-
def oldEsDependency = configurations['es' + version]
126-
oldEsDependency.getAttributes().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
114+
// TODO Rene: we should be able to replace these unzip tasks with gradle artifact transforms
115+
TaskProvider<Sync> unzip = tasks.register("unzipEs${version}", Sync) {
116+
Configuration oldEsDependency = configurations['es' + version]
117+
dependsOn oldEsDependency
118+
/* Use a closure here to delay resolution of the dependency until we need
119+
* it */
120+
from {
121+
oldEsDependency.collect { zipTree(it) }
122+
}
123+
into temporaryDir
124+
}
125+
127126
TaskProvider<AntFixture> fixture = tasks.register("oldEs${version}Fixture", AntFixture) {
128-
dependsOn project.configurations.oldesFixture, jdks.legacy, oldEsDependency
127+
dependsOn project.configurations.oldesFixture, jdks.legacy
128+
dependsOn unzip
129129
executable = "${BuildParams.runtimeJavaHome}/bin/java"
130130
env 'CLASSPATH', "${-> project.configurations.oldesFixture.asPath}"
131131
// old versions of Elasticsearch need JAVA_HOME
@@ -136,7 +136,7 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
136136
}
137137
args 'oldes.OldElasticsearch',
138138
baseDir,
139-
"${ -> oldEsDependency.singleFile.getPath()}",
139+
unzip.get().temporaryDir,
140140
version == '090'
141141
waitCondition = { fixture, ant ->
142142
// the fixture writes the ports file when Elasticsearch's HTTP service

qa/repository-old-versions/build.gradle

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import org.elasticsearch.gradle.Version
1414
import org.elasticsearch.gradle.internal.info.BuildParams
1515
import org.elasticsearch.gradle.internal.test.AntFixture
1616
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
17-
import org.elasticsearch.gradle.transform.UnzipTransform
18-
import org.gradle.api.internal.artifacts.ArtifactAttributes
1917

2018
apply plugin: 'elasticsearch.jdk-download'
2119
apply plugin: 'elasticsearch.internal-testclusters'
@@ -42,29 +40,34 @@ jdks {
4240
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
4341
logger.warn("Disabling repository-old-versions tests because we can't get the pid file on windows")
4442
} else {
45-
/* Register a gradle artifact transformation to unpack resolved elasticsearch distributions. We only resolve
46-
* zip files here. Using artifact transforms allow a better caching of the downloaded distros as the
47-
* transformed (unpacked) distro will be cached by gradle resulting in less unpacking
48-
*
43+
/* Set up tasks to unzip and run the old versions of ES before running the integration tests.
4944
* To avoid testing against too many old versions, always pick first and last version per major
5045
*/
51-
project.getDependencies().registerTransform(UnzipTransform.class, transformSpec -> {
52-
transformSpec.getFrom().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.ZIP_TYPE);
53-
transformSpec.getTo().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
54-
});
55-
5646
for (String versionString : ['5.0.0', '5.6.16', '6.0.0', '6.8.20']) {
5747
Version version = Version.fromString(versionString)
5848
String packageName = 'org.elasticsearch.distribution.zip'
5949
String artifact = "${packageName}:elasticsearch:${version}@zip"
6050
String versionNoDots = version.toString().replace('.', '_')
6151
String configName = "es${versionNoDots}"
6252

63-
def config = configurations.create(configName)
64-
config.getAttributes().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
53+
configurations.create(configName)
54+
6555
dependencies.add(configName, artifact)
6656

57+
// TODO Rene: we should be able to replace these unzip tasks with gradle artifact transforms
58+
TaskProvider<Sync> unzip = tasks.register("unzipEs${versionNoDots}", Sync) {
59+
Configuration oldEsDependency = configurations[configName]
60+
dependsOn oldEsDependency
61+
/* Use a closure here to delay resolution of the dependency until we need
62+
* it */
63+
from {
64+
oldEsDependency.collect { zipTree(it) }
65+
}
66+
into temporaryDir
67+
}
68+
6769
String repoLocation = "${buildDir}/cluster/shared/repo/${versionNoDots}"
70+
6871
String clusterName = versionNoDots
6972

7073
def testClusterProvider = testClusters.register(clusterName) {
@@ -73,7 +76,8 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
7376
}
7477

7578
TaskProvider<AntFixture> fixture = tasks.register("oldES${versionNoDots}Fixture", AntFixture) {
76-
dependsOn project.configurations.oldesFixture, jdks.legacy, config
79+
dependsOn project.configurations.oldesFixture, jdks.legacy
80+
dependsOn unzip
7781
executable = "${BuildParams.runtimeJavaHome}/bin/java"
7882
env 'CLASSPATH', "${-> project.configurations.oldesFixture.asPath}"
7983
// old versions of Elasticsearch need JAVA_HOME
@@ -84,7 +88,7 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
8488
}
8589
args 'oldes.OldElasticsearch',
8690
baseDir,
87-
"${ -> config.getSingleFile().toPath()}",
91+
unzip.get().temporaryDir,
8892
false,
8993
"path.repo: ${repoLocation}"
9094
maxWaitInSeconds 60

0 commit comments

Comments
 (0)