Jenkins pipeline - parallel stages merging only at the last stage

主宰稳场 提交于 2019-12-08 08:45:38

问题


I tried looking at the Jenkins pipeline documentation and more importantly the issue JENKINS-38442 before asking this question.

I would like to create a pipeline that looks like this:

Basically, I would like the parallel stages to merge at different stages rather than the next stage itself. Is this possible?

The best I could do so far is only this:

Below is the pipeline code that generated the above pipeline:

node {
   def staticTests = [:]
   staticTests["unit tests"] = {stage('unit'){ }}
   staticTests["static analysis"] = {stage('static'){ }}

   def tests = [:]
   tests["functional"] = {stage('functional'){}}
   tests["performance"] = {stage('performance'){}}
   tests["security"] = {stage('security'){}}

   stage('prepare'){}
   stage('tests'){parallel(staticTests)}
   stage('build'){}
   stage('int'){}
   stage('regression'){}
   stage('qa'){}
   stage('tests'){ parallel(tests) }
   stage('prod'){}
}

What changes will help me to create the pipeline as desired in the modified screenshot pasted above? Is this even possible today with Jenkins pipelines? Thank you for the help in advance!


回答1:


Well you could write

node {
  stage('prepare') {}
  parallel main: {
    stage('unit tests') {}
    stage('build') {}
    stage('int') {}
    stage('regression') {}
    stage('qa') {}
    parallel functional: {}, performance: {}, security: {}
  }, 'static analysis': {}
  stage('prod') {}
}

which will run the way you request (if I understand correctly), but Blue Ocean is not currently able to display it at an appropriate level of detail, as noted in JENKINS-38442.



来源:https://stackoverflow.com/questions/41077941/jenkins-pipeline-parallel-stages-merging-only-at-the-last-stage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!