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:
Alpar Torok 2019-10-22 17:03:07 +03:00
parent 2f162a98a0
commit b4ae207e1e
1 changed files with 43 additions and 43 deletions

View File

@ -11,23 +11,18 @@ if (buildNumber) {
project.delete(uploadFile)
}
OS.current()
.conditional()
.onUnix {
def isWindows = OS.current() == OS.WINDOWS
if (OS.current() == OS.LINUX) {
project.exec {
ignoreExitValue = true
workingDir projectDir
commandLine 'bash', '-c', 'journalctl --since "1 hour ago" 2>&1 > journalctl.log'
}
}
.onWindows {
}
.onMac {
}
try {
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
fileset(dir: projectDir) {
fileTree(projectDir)
.include("**/*.hprof")
.include("**/reaper.log")
@ -38,8 +33,10 @@ if (buildNumber) {
.exclude("**/build/testclusters/**/repo/**")
.exclude("**/build/testclusters/**/extract/**")
.filter { Files.isRegularFile(it.toPath()) }
.each { fileset(file: it) }
.each {
include(name: projectDir.toPath().relativize(it.toPath()))
}
}
fileset(dir: "${gradle.gradleUserHomeDir}/daemon/${gradle.gradleVersion}", followsymlinks: false) {
include(name: "**/daemon-${ProcessHandle.current().pid()}*.log")
@ -55,5 +52,8 @@ if (buildNumber) {
}
}
}
} catch (Exception e) {
logger.lifecycle("Failed to archive additional logs", e)
}
}
}