In the example below, I'd like to have the ability to choose, from a parameter, to start the job on any of the stages. the 'when' conditional does help, but I don't know how to have it start at say stage2, and then complete all the stages after it. Currently as it is below, it will only do the stage that is selected for the START_AT parameter and skip all of the others.
pipeline {
agent any
parameters {
choice(name: 'START_FROM', choices: ['stage1', 'stage2', 'stage3'], description: 'Choose which step to start the job on.')
}
stages {
stage('stage1') {
when {
expression { params.START_FROM == 'stage1' }
}
steps {
echo "stage1 executing"
}
}
stage('stage2') {
when {
expression { params.START_FROM == 'stage2' }
}
steps {
echo "stage1 executing"
}
}
stage('stage3') {
when {
expression { params.START_FROM == 'stage3' }
}
steps {
echo "stage1 executing"
}
}
}
}