59 lines
2.1 KiB
Groovy
59 lines
2.1 KiB
Groovy
import java.nio.file.Files
|
|
import org.elasticsearch.gradle.OS
|
|
|
|
String buildNumber = System.getenv('BUILD_NUMBER')
|
|
|
|
if (buildNumber) {
|
|
File uploadFile = file("build/${buildNumber}.tar.bz2")
|
|
project.gradle.buildFinished { result ->
|
|
println "build complete, generating: $uploadFile"
|
|
if (uploadFile.exists()) {
|
|
project.delete(uploadFile)
|
|
}
|
|
|
|
OS.current()
|
|
.conditional()
|
|
.onUnix {
|
|
project.exec {
|
|
ignoreExitValue = true
|
|
workingDir projectDir
|
|
commandLine 'bash', '-c', 'journalctl --since "1 hour ago" 2>&1 > journalctl.log'
|
|
}
|
|
}
|
|
.onWindows {
|
|
|
|
}
|
|
.onMac {
|
|
|
|
}
|
|
|
|
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
|
|
fileTree(projectDir)
|
|
.include("**/*.hprof")
|
|
.include("**/reaper.log")
|
|
.include("**/journalctl.log")
|
|
.include("**/build/testclusters/**")
|
|
.exclude("**/build/testclusters/**/data/**")
|
|
.exclude("**/build/testclusters/**/distro/**")
|
|
.exclude("**/build/testclusters/**/repo/**")
|
|
.exclude("**/build/testclusters/**/extract/**")
|
|
.filter { Files.isRegularFile(it.toPath()) }
|
|
.each { fileset(file: it) }
|
|
|
|
|
|
fileset(dir: "${gradle.gradleUserHomeDir}/daemon/${gradle.gradleVersion}", followsymlinks: false) {
|
|
include(name: "**/daemon-${ProcessHandle.current().pid()}*.log")
|
|
}
|
|
|
|
if (Files.isReadable(file("/var/log/").toPath())) {
|
|
Files.list(file("/var/log/").toPath())
|
|
.filter { it.fileName.endsWith(".log") }
|
|
.filter { Files.isReadable(it) }
|
|
.filter { Files.isRegularFile(it) }
|
|
.forEach {
|
|
fileset(file: it)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |