Compare commits
2 Commits
5f7f1d25b4
...
bb3021dd4c
Author | SHA1 | Date | |
---|---|---|---|
bb3021dd4c | |||
e68a84b851 |
@ -14,6 +14,20 @@ def setSuccessCheck(String name, String title) {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Helper function that emits `Success` status.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
def setFailureCheck(String name, String title) {
|
||||||
|
publishChecks(
|
||||||
|
name: name,
|
||||||
|
title: title,
|
||||||
|
summary: '— Failed',
|
||||||
|
conclusion: "FAILURE"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
* Replacement for `stage` function for default pipeline.
|
* Replacement for `stage` function for default pipeline.
|
||||||
*
|
*
|
||||||
* Has the same arguments but does side-effects to the stage:
|
* Has the same arguments but does side-effects to the stage:
|
||||||
@ -25,8 +39,14 @@ def setSuccessCheck(String name, String title) {
|
|||||||
*/
|
*/
|
||||||
def stageWithChecks(String name, Closure body) {
|
def stageWithChecks(String name, Closure body) {
|
||||||
stage(name) {
|
stage(name) {
|
||||||
body()
|
try {
|
||||||
setSuccessCheck(name, name)
|
body()
|
||||||
|
setSuccessCheck(name, name)
|
||||||
|
} catch (error) {
|
||||||
|
sh "echo Stage $name failed with error: $error"
|
||||||
|
setFailureCheck(name, name)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user