-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Pipeline stage view plugin v2.19
Here is a sample pipeline, there are nested stage to make sure env is locked during deployment and verification. The stages appear in sequence when nested stages are executed.
When the pipeline is restarted using "Restart from Stage" and a later stage is picked, e.g. a prod one. Then, the nested stage go out of order. Images attached
def deployToProd = false pipeline { agent none options { timestamps() buildDiscarder(logRotator(numToKeepStr: '20')) skipStagesAfterUnstable() timeout time: 30, unit: 'MINUTES' } stages { stage('Build') { agent none steps { script { println 'in build stage' } } } stage('Lock dev') { options { lock resource: "${JOB_NAME}-dev", quantity: 1, variable: 'deployEnv' } when { beforeOptions true beforeAgent true branch 'master' } stages { stage('Deploy to dev') { when { beforeOptions true beforeAgent true branch 'master' } agent none steps { script { println 'in deploy to dev stage' } } } stage('testing in dev') { when { beforeOptions true beforeAgent true branch 'master' } agent none steps { script { println 'run tests in dev' } } } } } stage('Lock test') { options { lock resource: "${JOB_NAME}-test", quantity: 1, variable: 'deployEnv' } stages { stage('Deploy to test') { when { beforeAgent true branch 'master' } agent none steps { script { println 'in deploy to test stage' } } } stage('testing in test') { when { beforeAgent true branch 'master' } agent none steps { script { println 'run tests in test' } } } } } stage('Approve prod?') { when { beforeAgent true branch 'master' } agent none steps { script { def proceed = true try { timeout(time: 10, unit: 'SECONDS') { input(message: 'Deploy this build to PROD?') } } catch (err) { proceed = false } if (proceed) { deployToProd = true } } } } stage('Deploy to prod') { options { lock resource: "${JOB_NAME}-prod", quantity: 1, variable: 'deployEnv' } when { beforeAgent true branch 'master' expression { return deployToProd } } agent none steps { script { println 'in deploy to prod stage' } } } } }