mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -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();
|
||||
}
|
||||
|
||||
public static File locateElasticsearchWorkspace(Gradle gradle) {
|
||||
if(gradle.getRootProject().getName().startsWith("build-tools")) {
|
||||
File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
||||
if(versionFileExists(buildToolsParent)) {
|
||||
return buildToolsParent;
|
||||
}
|
||||
public static File locateElasticsearchWorkspace(Gradle gradle) {
|
||||
if (gradle.getRootProject().getName().startsWith("build-tools")) {
|
||||
File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
||||
if (versionFileExists(buildToolsParent)) {
|
||||
return buildToolsParent;
|
||||
}
|
||||
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());
|
||||
}
|
||||
return buildToolsParent;
|
||||
}
|
||||
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) {
|
||||
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
|
||||
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
|
||||
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
|
||||
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() {
|
||||
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()) {
|
||||
try {
|
||||
return Files.readAllLines(exclusionsFile.toPath())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue