HHH-15538 Move Jenkinsfile timeout around shell command

This commit is contained in:
Christian Beikov 2022-09-21 11:23:07 +02:00
parent 6b8a782d50
commit f8c25fda1c
1 changed files with 7 additions and 3 deletions

6
Jenkinsfile vendored
View File

@ -257,7 +257,7 @@ void runBuildOnNode(String label, Closure body) {
node( label ) { node( label ) {
pruneDockerContainers() pruneDockerContainers()
try { try {
timeout( [time: 120, unit: 'MINUTES'], body ) body()
} }
finally { finally {
// If this is a PR, we clean the workspace at the end // If this is a PR, we clean the workspace at the end
@ -281,14 +281,18 @@ void runTest(String goal, String lockableResource = null, boolean clean = true)
String cmd = "./gradlew" + (clean ? " clean" : "") + " check ${goal} -Plog-test-progress=true --stacktrace"; String cmd = "./gradlew" + (clean ? " clean" : "") + " check ${goal} -Plog-test-progress=true --stacktrace";
try { try {
if (lockableResource == null) { if (lockableResource == null) {
timeout( [time: 120, unit: 'MINUTES'] ) {
sh cmd sh cmd
} }
}
else { else {
lock(lockableResource) { lock(lockableResource) {
timeout( [time: 120, unit: 'MINUTES'] ) {
sh cmd sh cmd
} }
} }
} }
}
finally { finally {
junit '**/target/test-results/test/*.xml,**/target/test-results/testKitTest/*.xml' junit '**/target/test-results/test/*.xml,**/target/test-results/testKitTest/*.xml'
} }