Skip to content

Commit b8dc64b

Browse files
mashhursmergify[bot]
authored andcommitted
Display logs with gradle task logs if ES build fails. (#292)
(cherry picked from commit 565204a)
1 parent d8f23cb commit b8dc64b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,16 @@ task buildElasticsearchLocalDistro(dependsOn: unzipDownloadedElasticsearchSource
243243
ignoreExitValue true // handled in doLast
244244
doLast {
245245
def exitValue = executionResult.get().exitValue
246-
assert exitValue == 0 : "Elasticsearch build failed; logs available in ${logFile.path}"
246+
if (exitValue != 0) {
247+
if (logFile.exists()) {
248+
println "\n===== Elasticsearch Build Log ====="
249+
println logFile.text
250+
println "===== End of Build Log =====\n"
251+
} else {
252+
"Elasticsearch build failed and ${logFile.path} log does not exist"
253+
}
254+
throw new GradleException("Elasticsearch build failed, see the logs for details.")
255+
}
247256
assert ext.localDistroResult.isPresent() : "Elasticsearch did not produce exactly one localdistro build"
248257
}
249258
}

0 commit comments

Comments
 (0)