Relative paths, jornalctl in additional logs (#48276)
* Relative paths, jornalctl in additional logs This PR fixes the archive generation to preserve the paths relative to the project directory. It also fixes calling journalctl to get the system log. * explicitly remove the file we are building * Skip files locked on windows * Extended readability probe * Try to read the file ahead on windows * Make the tar a best effort * Catch all exceptions
This commit is contained in:
parent
2f162a98a0
commit
b4ae207e1e
|
@ -11,49 +11,49 @@ if (buildNumber) {
|
||||||
project.delete(uploadFile)
|
project.delete(uploadFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
OS.current()
|
def isWindows = OS.current() == OS.WINDOWS
|
||||||
.conditional()
|
if (OS.current() == OS.LINUX) {
|
||||||
.onUnix {
|
project.exec {
|
||||||
project.exec {
|
ignoreExitValue = true
|
||||||
ignoreExitValue = true
|
workingDir projectDir
|
||||||
workingDir projectDir
|
commandLine 'bash', '-c', 'journalctl --since "1 hour ago" 2>&1 > journalctl.log'
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
|
||||||
|
fileset(dir: projectDir) {
|
||||||
|
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 {
|
||||||
|
include(name: projectDir.toPath().relativize(it.toPath()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.lifecycle("Failed to archive additional logs", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue