Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit f60d14a

Browse files
committed
Handle the case of not able to spin slave pod
This PR will handle the case if it is not able to spin a slave pod Now it will through a nice message to user Fixes openshiftio/openshift.io#3797
1 parent 229a896 commit f60d14a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

vars/pod.groovy

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ def call(Map args = [:], body = null) {
1414
],
1515
volumes: volumes(),
1616
) {
17-
node (label) {
18-
container(name: args.name, shell: args.shell) {
19-
body()
17+
try {
18+
timeout(time: 30, unit: 'MINUTES') {
19+
node (label) {
20+
container(name: args.name, shell: args.shell) {
21+
body()
22+
}
23+
}
2024
}
25+
} catch (e) {
26+
status = "fail"
27+
currentBuild.result = 'FAILED'
28+
error "Not able to start a slave pod with label ${label}"
29+
} finally {
30+
Events.emit(["build.end", "build.${status}"], [status: status, namespace: namespace])
2131
}
2232
}
2333
}

0 commit comments

Comments
 (0)