-
Improvement
-
Resolution: Fixed
-
Major
Post stages currently have a defined order in which they run. This limits certain use cases (especially in regards to clean up procedures). It would be nice to be able to specify certain post stages have to run before others.
pipeline { agent { label 'label' } stages { stage('stage') { steps { echo "stage" } post { success { echo "Success" } always { echo "Always" //deleteDir() } } } } }
[Pipeline] { [Pipeline] stage [Pipeline] { (stage) [Pipeline] echo stage [Pipeline] echo Post stage [Pipeline] echo Always [Pipeline] echo Success [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline
In the example Jenkinsfile, I want success to run before always. In my production use case, I want to stash some artifacts for a future stage. The future stage is set up to run on certain conditions, so clean up cannot be delayed.
How order should be determined is open ended. To me, running in the Jenkinsfile order is more intuitive for a user, but there may be cases where you want to change that.
- is duplicated by
-
JENKINS-46378 Pipeline Model Definition Post Action Order
- Closed
- relates to
-
JENKINS-41239 Error during always block skips execution of remaining steps
- Closed
-
JENKINS-38993 Deterministic order of build condition block execution in Declarative
- Closed