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

Commit 3d858e2

Browse files
committed
Handle the case if 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 3d858e2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

vars/pod.groovy

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ 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+
currentBuild.result = 'FAILED'
27+
error "Not able to start a slave pod with label ${label}"
28+
Events.emit(["build.end", "build.fail"], [status: status, namespace: namespace])
2129
}
2230
}
2331
}

0 commit comments

Comments
 (0)