I am aware that similar propositions have been made, but no solution has been found for this scenario, which is very common in our organization.
Suppose there are stages that are project-specific, i.e., S1, S2, ..., Sn, and stages that are project-independent (can be factored out into shared lib), i.e., I1, I2, ..., Im. A pipeline for a project should contains both the project-specific stages as well as the project-independent stages, the latter possiby multiple times, e.g.,
S1, S2, ..., Sn, I1, I2, ..., Im, I1', I2', ..., Im'
It would be great to be able to define such a pipeline like this: {code:java} pipeline { stages { stage ("S1") { ... } stage ("S2") { ... } ... stage ("Sn") { ... } sharedSteps sharedStages () sharedSteps sharedStages () } }
def sharedSteps sharedStages () { stage ("I1") { ... } stage ("I2") { ... } ... stage ("In") { ... } }{code} |
|