mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-11-28 08:49:44 +02:00
Add a milestone for Confirm stage (#2087)
This commit will prevent abortion of older builds which are waiting in the Confirm stage, if a newer build fails in the last stage before the Confirm stage. Example: If the 'Compliance' stage of the general purpose pipeline (piperPipeline.groovy) fails, it will abort all former builds which are waiting in the 'Confirm' stage. The milestone function is called without an explicit ordinal since people might use the stage on different positions within their pipeline. When no ordinal is given, the last milestone ordinal value will be increased by 1. Note: Confirming a build will still abort all older builds waiting at the Confirm stage.
This commit is contained in:
parent
fe1fc7bd69
commit
9ffe52d1f4
@ -16,6 +16,7 @@ class PiperPipelineStageConfirmTest extends BasePiperTest {
|
||||
|
||||
private Map timeoutSettings
|
||||
private Map inputSettings
|
||||
private milestoneCalled = false
|
||||
|
||||
@Rule
|
||||
public RuleChain rules = Rules
|
||||
@ -37,6 +38,10 @@ class PiperPipelineStageConfirmTest extends BasePiperTest {
|
||||
inputSettings = m
|
||||
return [reason: 'this is my test reason for failing step 1 and step 3', acknowledgement: true]
|
||||
})
|
||||
|
||||
helper.registerAllowedMethod('milestone', [],{
|
||||
milestoneCalled = true
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -77,4 +82,13 @@ class PiperPipelineStageConfirmTest extends BasePiperTest {
|
||||
assertThat(jlr.log, containsString('this is my test reason'))
|
||||
assertThat(jlr.log, containsString('Acknowledgement\n---------------\n☑ I acknowledge that for traceability purposes the approval reason is stored together with my user name / user id'))
|
||||
}
|
||||
|
||||
@Test
|
||||
void callsMilestone(){
|
||||
jsr.step.piperPipelineStageConfirm(
|
||||
script: nullScript
|
||||
)
|
||||
|
||||
assertThat(milestoneCalled, is(true))
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ void call(Map parameters = [:]) {
|
||||
boolean approval = false
|
||||
def userInput
|
||||
|
||||
milestone()
|
||||
|
||||
timeout(
|
||||
unit: 'HOURS',
|
||||
time: config.manualConfirmationTimeout
|
||||
|
Loading…
Reference in New Issue
Block a user