I am interested in a scenario that looks like this: stages { stage('extract') { } stage('build') { parallel { stage('build product A') { stage('build module set 1') { } stage('build module set 2') { } } stage('build product B') { } } } stage('finalize') { } } The outcome order would be that build only occurs after extract, that finalize only occurs after all build sub-stage are completed. That build product A and build procduct B are done in parallel. That build module set 2 only occurs after build module set 1 has completed (since it has some dependencies). Now, I feel that using "stages" inside a "stage" or a "stages" tag make no sense. Also, indenting those "stage" looks messy. A suggestion would be to do this operation like Make does, by stating the stages first, then adjusting the dependencies later, i.e.: stages { stage('extract') { } stage('build product A') { } stage('build module set 1') { } stage('build module set 2') { } stage('build product B') { } stage('finalize') { } } This would be default create a set of dependencies such as <target>: <dependencies> 'build product A': 'extract' 'build module set 1': 'build product A' 'build module set 2': 'build module set 1' 'build product B': 'build module set 2' 'finalize': 'build product B' Same as today, the author can then change those dependencies from the default to what he wants: stages { stage('extract') { } stage('build product A') { } stage('build module set 1') { } stage('build module set 2') { } stage('build product B') { dependencies: [ 'extract' ] } stage('finalize') { dependencies: ['build product A', 'build product B'] } } This effectively transforming the dependency table to <target>: <dependencies> 'build product A': 'extract' 'build module set 1': 'build product A' 'build module set 2': 'build module set 1' 'build product B': 'extract' 'finalize': 'build product A', 'build product B' Using this set of dependency, the parallelism used is imply in the dependency, as soon as a target dependency are met, the associated stage can start. This is backward compatible, get rid of the "parallel" declarative statement and add a minimum set of keywords "dependencies" to the current DSL. Anyway, just a need of mine and an opinion to share on how to do it. |