From ade82f21b75d6088ac1c7682c9e9f5db5056d6ab Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Tue, 22 Oct 2024 08:59:32 -0700 Subject: [PATCH] Timeout on buildkite uploads but don't fail the build --- .../main/groovy/elasticsearch.build-complete.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.build-complete.gradle b/build-tools-internal/src/main/groovy/elasticsearch.build-complete.gradle index 996fb420f862e..d50cb318cf832 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.build-complete.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.build-complete.gradle @@ -7,6 +7,7 @@ */ import java.nio.file.Files +import java.util.concurrent.TimeUnit String buildNumber = System.getenv('BUILD_NUMBER') ?: System.getenv('BUILDKITE_BUILD_NUMBER') Boolean isNested = System.getProperty("scan.tag.NESTED") != null @@ -68,9 +69,13 @@ if (buildNumber && isNested == false) { if (uploadFile.exists() && System.getenv("BUILDKITE") == "true") { try { println "Uploading buildkite artifact: ${uploadFilePath}..." - new ProcessBuilder("buildkite-agent", "artifact", "upload", uploadFilePath) - .start() - .waitFor() + try { + new ProcessBuilder("buildkite-agent", "artifact", "upload", uploadFilePath) + .start() + .waitFor(30, TimeUnit.MINUTES) + } catch (InterruptedException e) { + System.out.println("Failed to upload buildkite artifact " + e.getMessage()); + } println "Generating buildscan link for artifact..."