Compare commits

..

2 Commits

Author SHA1 Message Date
bb3021dd4c Throw after setting failure check status 2023-12-14 21:56:51 +03:00
e68a84b851 Added failure check status on error 2023-12-14 21:56:21 +03:00

View File

@ -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.
*
* 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) {
stage(name) {
try {
body()
setSuccessCheck(name, name)
} catch (error) {
sh "echo Stage $name failed with error: $error"
setFailureCheck(name, name)
throw error
}
}
}
/* -------------------------------------------------------------------------- */