Declarative pipeline - Repeating a stage after getting some input

31 views
Skip to first unread message

ishan jain

unread,
Apr 11, 2017, 9:48:50 AM4/11/17
to Jenkins Users
I am using declarative pipeline syntax to implement continuous integration and here is a part of the pipeline

stage ('Tag') {
when {
                expression {
return releaseVersion()
}
            }
agent { label 'master' }
steps {
script {
// tag some stuff
}
}
}
stage ('Promote') {
agent none
steps {
def promote = input message: "Promote to " + nextVersion()
if (promote) {
 // need to do some stuff and call 'Tag' stage above again 
} else {
// end
}
}
}


I am not sure how can i re-call a stage again. I do not have enterprise edition, so not looking into checkpoint. The tag stage does the same work but with a different value and hence i do not wish to rewrite that stage again and again. In regular groovy code, i would define the stage {} inside a method and i would then just need to call it again. But with declarative pipeline, things are different.
Reply all
Reply to author
Forward
0 new messages