| I found myself needing something similar - a set of mutually exclusive stages of which only one should execute. I would actually prefer something like this:
stage ("Do It") {
switch {
stage("Stage A") {
when { expression { return conditionA } }
steps { ... }
}
stage("Stage B") {
when { expression { return conditionB } }
steps { ... }
}
stage("Stage C") {
steps { ... }
}
}
}
This means "If condition A, do Stage A. Else if condition B, do Stage B. Else, do Stage C." switch would be at the same level as stages, parallel, and matrix today. This allows Blue Ocean to clearly display the mutually exclusive stages (probably in a vertical arrangement, like it does for parallel). |