mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Fix file path when looking for docker exclusions file (#105304)
This commit is contained in:
parent
97dbb2a27e
commit
6c4e55e714
3 changed files with 22 additions and 21 deletions
|
@ -119,29 +119,29 @@ public class Util {
|
||||||
return project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets();
|
return project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File locateElasticsearchWorkspace(Gradle gradle) {
|
public static File locateElasticsearchWorkspace(Gradle gradle) {
|
||||||
if(gradle.getRootProject().getName().startsWith("build-tools")) {
|
if (gradle.getRootProject().getName().startsWith("build-tools")) {
|
||||||
File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
||||||
if(versionFileExists(buildToolsParent)) {
|
if (versionFileExists(buildToolsParent)) {
|
||||||
return buildToolsParent;
|
|
||||||
}
|
|
||||||
return buildToolsParent;
|
return buildToolsParent;
|
||||||
}
|
}
|
||||||
if (gradle.getParent() == null) {
|
return buildToolsParent;
|
||||||
// See if any of these included builds is the Elasticsearch gradle
|
|
||||||
for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
|
|
||||||
if (versionFileExists(includedBuild.getProjectDir())) {
|
|
||||||
return includedBuild.getProjectDir();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise assume this gradle is the root elasticsearch workspace
|
|
||||||
return gradle.getRootProject().getRootDir();
|
|
||||||
} else {
|
|
||||||
// We're an included build, so keep looking
|
|
||||||
return locateElasticsearchWorkspace(gradle.getParent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (gradle.getParent() == null) {
|
||||||
|
// See if any of these included builds is the Elasticsearch gradle
|
||||||
|
for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
|
||||||
|
if (versionFileExists(includedBuild.getProjectDir())) {
|
||||||
|
return includedBuild.getProjectDir();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise assume this gradle is the root elasticsearch workspace
|
||||||
|
return gradle.getRootProject().getRootDir();
|
||||||
|
} else {
|
||||||
|
// We're an included build, so keep looking
|
||||||
|
return locateElasticsearchWorkspace(gradle.getParent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean versionFileExists(File rootDir) {
|
private static boolean versionFileExists(File rootDir) {
|
||||||
return new File(rootDir, "build-tools-internal/version.properties").exists();
|
return new File(rootDir, "build-tools-internal/version.properties").exists();
|
||||||
|
|
|
@ -144,6 +144,7 @@ public class ElasticsearchTestBasePlugin implements Plugin<Project> {
|
||||||
// don't track these as inputs since they contain absolute paths and break cache relocatability
|
// don't track these as inputs since they contain absolute paths and break cache relocatability
|
||||||
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
|
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
|
||||||
nonInputProperties.systemProperty("gradle.user.home", gradleUserHome);
|
nonInputProperties.systemProperty("gradle.user.home", gradleUserHome);
|
||||||
|
nonInputProperties.systemProperty("workspace.dir", Util.locateElasticsearchWorkspace(project.getGradle()));
|
||||||
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
|
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
|
||||||
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
|
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ public abstract class DockerEnvironmentAwareTestContainer extends GenericContain
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getLinuxExclusionList() {
|
private static List<String> getLinuxExclusionList() {
|
||||||
File exclusionsFile = new File(DOCKER_ON_LINUX_EXCLUSIONS_FILE);
|
File exclusionsFile = new File(System.getProperty("workspace.dir"), DOCKER_ON_LINUX_EXCLUSIONS_FILE);
|
||||||
if (exclusionsFile.exists()) {
|
if (exclusionsFile.exists()) {
|
||||||
try {
|
try {
|
||||||
return Files.readAllLines(exclusionsFile.toPath())
|
return Files.readAllLines(exclusionsFile.toPath())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue