I think this is a dupe of JENKINS-46354, which was fixed in Pipeline Declarative Plugin version 1.3.8. Here is the Pipeline I used to verify that the issue was fixed:
pipeline {
agent any
stages {
stage("test") {
options {
retry(3)
}
steps {
sh 'if (( $RANDOM % 2 )); then exit 0; else exit 1; fi;'
}
}
}
}
Here is the log output from a build with one retry:
Started by user unknown or anonymous
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /Users/dnusbaum/Projects/pipeline-model-definition-plugin/pipeline-model-definition/work/workspace/retry
[Pipeline] {
[Pipeline] stage
[Pipeline] { (test)
[Pipeline] retry
[Pipeline] {
[Pipeline] sh
+ (( 5334 % 2 ))
+ exit 1
[Pipeline] }
ERROR: script returned exit code 1
Retrying
[Pipeline] {
[Pipeline] sh
+ (( 24899 % 2 ))
+ exit 0
[Pipeline] }
[Pipeline] // retry
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
I also tested with the options at the top level rather than in the stage, and got the same result. I am going to close this as a dupe of JENKINS-46354, feel free to reopen if you are still seeing the issue. If you do reopen the ticket, please include a simple Pipeline that reproduces the problem so we can understand how it differs from JENKINS-46354. |