-
Bug
-
Resolution: Unresolved
-
Critical
-
-
Declarative backlog
In a longer pipeline it is possible that one needs to check if a step has been restarted more than one time.
Lets say steps 3 and 7 must behave different when they are restarted.
If we restart the step 3 the isRestartedRun() will be true and trick step 7 in believing it has been restarted (when it was not, 3 was the one restarted).
We need a way to reset this, perhaps after the first step after the restart is completed.
I marked this as Critical because it really misleads the code in later stages into executing the wrong code based on misinformation. Here is one example:
stages {
stage('DoWork') {
when
}
agent any
steps
}
}
stage('RestartWork') {
when
agent any
steps { <Do it differently because the step was restarted and some things cannot/should not be done again on restart> ) }
}
}
stage('FlagTest') {
when { isRestartedRun() }
agent any
steps
}
}
The last stage above does get executed, as shown in this console output:
[Pipeline] echoisRestartedRun should be false here
- is related to
-
JENKINS-53193 Provide currentBuild.isRestartedRun and .isRestartedStage global variables
- Open
- links to