詹金斯管道 - 平行阶段只在最后阶段合并 [英] Jenkins pipeline - parallel stages merging only at the last stage

查看:131
本文介绍了詹金斯管道 - 平行阶段只在最后阶段合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着查看Jenkins管道文档,更重要的是问题JENKINS-38442 之前问这个问题。

我想创建一个如下所示的管道:


基本上,我希望并行阶段在不同阶段合并,而不是在下一阶段本身。这可能吗?



目前为止我能做的最好的只有这个:

以下是生成上述管道的管道代码:

  node {
def staticTests = [:]
staticTests [unit tests] = {stage('unit'){}}
staticTests [static分析] = {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'){}
}

哪些更改将帮助我根据需要创建管道在修改后的截图上面粘贴?詹金斯管道今天甚至有可能吗?感谢您的帮助!

解决方案

您可以写入

< pre $ node {
stage('prepare'){}
parallel main:{
stage('unit tests'){}
stage('build'){}
stage('int'){}
stage('regression'){}
stage('qa'){}
并行功能:{},效果:{},安全性:{}
},'静态分析':{}
stage('prod'){}
}

这将按照您的要求运行(如果我理解正确的话),但Blue Ocean目前无法运行如JENKINS-38442中所述,以适当的详细程度显示它。


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!

解决方案

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.

这篇关于詹金斯管道 - 平行阶段只在最后阶段合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆