From 40d429792f29c0d26158b24114a52f3b69069a55 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 3 Jul 2025 12:37:06 -0700 Subject: [PATCH] Reenable windows upload and fix archive paths When windows builds fail, we need the local logs for diagnosing the issue. This commit re-enables archiving the log files from windows builds for upload. It also fixes that archive to use the correct tar entry path separator on windows. relates #115449 --- .../internal/ElasticsearchBuildCompletePlugin.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java index 065a57f801c9e..80fd320fb8fb4 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java @@ -66,7 +66,7 @@ public void apply(Project target) { ? System.getenv("BUILD_NUMBER") : System.getenv("BUILDKITE_BUILD_NUMBER"); String performanceTest = System.getenv("BUILD_PERFORMANCE_TEST"); - if (buildNumber != null && performanceTest == null && GradleUtils.isIncludedBuild(target) == false && OS.current() != OS.WINDOWS) { + if (buildNumber != null && performanceTest == null && GradleUtils.isIncludedBuild(target) == false) { File targetFile = calculateTargetFile(target, buildNumber); File projectDir = target.getProjectDir(); File gradleWorkersDir = new File(target.getGradle().getGradleUserHomeDir(), "workers/"); @@ -276,7 +276,12 @@ private static void createBuildArchiveTar(List files, File projectDir, Fil @NotNull private static String calculateArchivePath(Path path, Path projectPath) { - return path.startsWith(projectPath) ? projectPath.relativize(path).toString() : path.getFileName().toString(); + String archivePath = path.startsWith(projectPath) ? projectPath.relativize(path).toString() : path.getFileName().toString(); + if (OS.current() == OS.WINDOWS) { + // tar always uses forward slashes + archivePath = archivePath.replace("\\", "/"); + } + return archivePath; } } }