Skip to content

Commit cb14cdf

Browse files
committed
add toolExec helper method
1 parent 496b57b commit cb14cdf

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/devops/common/helpers.groovy

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
// src/devops/common/helpers.groovy
22
package devops.common
33

4-
// private method for vars
4+
// imports
5+
import hudson.AbortException
6+
7+
// generic tool execution
8+
void toolExec(String label, List<String> cmd) {
9+
try {
10+
sh(label: label, script: cmd.join(' '))
11+
}
12+
catch (AbortException error) {
13+
print "failure using ${label.toLowerCase()}"
14+
throw error
15+
}
16+
print "${label.toLowerCase()} was successful"
17+
}
18+
19+
// hashi vars
520
List<String> varSubCmd(Map config) {
621
List<String> subCmd = []
722

0 commit comments

Comments
 (0)