2019-10-18 01:14:46 -04:00
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
|
|
String buildNumber = System.getenv('BUILD_NUMBER')
|
|
|
|
|
|
|
|
if (buildNumber) {
|
2019-11-14 06:01:23 -05:00
|
|
|
File uploadFile = file("build/${buildNumber}.tar.bz2")
|
|
|
|
project.gradle.buildFinished { result ->
|
|
|
|
println "build complete, generating: $uploadFile"
|
|
|
|
if (uploadFile.exists()) {
|
|
|
|
project.delete(uploadFile)
|
|
|
|
}
|
2019-10-18 01:14:46 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
try {
|
|
|
|
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
|
|
|
|
fileset(dir: projectDir) {
|
2019-11-15 09:50:40 -05:00
|
|
|
Set<File> fileSet = fileTree(projectDir) {
|
|
|
|
include("**/*.hprof")
|
|
|
|
include("**/reaper.log")
|
|
|
|
include("**/build/testclusters/**")
|
|
|
|
exclude("**/build/testclusters/**/data/**")
|
|
|
|
exclude("**/build/testclusters/**/distro/**")
|
|
|
|
exclude("**/build/testclusters/**/repo/**")
|
|
|
|
exclude("**/build/testclusters/**/extract/**")
|
|
|
|
}
|
|
|
|
.files
|
|
|
|
.findAll { Files.isRegularFile(it.toPath()) }
|
|
|
|
|
|
|
|
if (fileSet.empty) {
|
|
|
|
// In cases where we don't match any workspace files, exclude everything
|
|
|
|
ant.exclude(name: "**/*")
|
|
|
|
} else {
|
|
|
|
fileSet.each {
|
|
|
|
ant.include(name: projectDir.toPath().relativize(it.toPath()))
|
2019-10-18 01:14:46 -04:00
|
|
|
}
|
2019-11-15 09:50:40 -05:00
|
|
|
}
|
2019-10-18 01:14:46 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
|
|
|
|
fileset(dir: "${gradle.gradleUserHomeDir}/daemon/${gradle.gradleVersion}", followsymlinks: false) {
|
|
|
|
include(name: "**/daemon-${ProcessHandle.current().pid()}*.log")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.lifecycle("Failed to archive additional logs", e)
|
2019-10-18 01:14:46 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2019-10-22 10:03:07 -04:00
|
|
|
}
|