Fix cases where we would unintentionally tar the entire build workspace (#49130)
Fix cases where we would unintentionally tar the entire build workspace
This commit is contained in:
parent
de8107e350
commit
69e69f5bff
|
@ -13,17 +13,25 @@ if (buildNumber) {
|
||||||
try {
|
try {
|
||||||
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
|
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") {
|
||||||
fileset(dir: projectDir) {
|
fileset(dir: projectDir) {
|
||||||
fileTree(projectDir)
|
Set<File> fileSet = fileTree(projectDir) {
|
||||||
.include("**/*.hprof")
|
include("**/*.hprof")
|
||||||
.include("**/reaper.log")
|
include("**/reaper.log")
|
||||||
.include("**/build/testclusters/**")
|
include("**/build/testclusters/**")
|
||||||
.exclude("**/build/testclusters/**/data/**")
|
exclude("**/build/testclusters/**/data/**")
|
||||||
.exclude("**/build/testclusters/**/distro/**")
|
exclude("**/build/testclusters/**/distro/**")
|
||||||
.exclude("**/build/testclusters/**/repo/**")
|
exclude("**/build/testclusters/**/repo/**")
|
||||||
.exclude("**/build/testclusters/**/extract/**")
|
exclude("**/build/testclusters/**/extract/**")
|
||||||
.filter { Files.isRegularFile(it.toPath()) }
|
}
|
||||||
.each {
|
.files
|
||||||
include(name: projectDir.toPath().relativize(it.toPath()))
|
.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()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue