Add hook utility basic implementation

このコミットが含まれているのは:
wpetit 2019-03-19 16:07:47 +01:00
コミット 97aa9b61dd
1個のファイルの変更15行の追加0行の削除

15
vars/hook.groovy ノーマルファイル
ファイルの表示

@ -0,0 +1,15 @@
def call(String name) {
def rootDir = pwd()
def filepath = "${rootDir}/.jenkins/${name}.groovy"
def exists = fileExists(filepath)
if (!exists) {
println("No hook '${filepath}' script. Skipping.")
return
}
def hook = load(filepath)
if(hook.metaClass.respondsTo(hook, 'exec')) {
hook.exec()
} else {
error("Hook script '${filepath}' exists but does not expose an exec() function.")
}
}