From 95960f46561f32c68931b4158a08d78889fea7ba Mon Sep 17 00:00:00 2001 From: Mashhur Date: Mon, 28 Apr 2025 12:09:18 -0700 Subject: [PATCH] Display logs with gradle task logs if ES build fails. --- build.gradle | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fea5a918..2021fb27 100644 --- a/build.gradle +++ b/build.gradle @@ -243,7 +243,16 @@ task buildElasticsearchLocalDistro(dependsOn: unzipDownloadedElasticsearchSource ignoreExitValue true // handled in doLast doLast { def exitValue = executionResult.get().exitValue - assert exitValue == 0 : "Elasticsearch build failed; logs available in ${logFile.path}" + if (exitValue != 0) { + if (logFile.exists()) { + println "\n===== Elasticsearch Build Log =====" + println logFile.text + println "===== End of Build Log =====\n" + } else { + "Elasticsearch build failed and ${logFile.path} log does not exist" + } + throw new GradleException("Elasticsearch build failed, see the logs for details.") + } assert ext.localDistroResult.isPresent() : "Elasticsearch did not produce exactly one localdistro build" } }