2016-10-20 41 views
5

詹金斯流水线插件如何运行并行任务詹金斯流水线插件如何运行并行任务

我在詹金斯初学者,我想推出采用流水线插件詹金斯的可用从属节点上并行几个任务。

我安装了管道插件,并添加到管道内嵌脚本部分的下面。

grovvy script : parallel firstBranch: { 
node('master'){ 
echo 'firstBranch' 
} 
}, secondBranch: { 
node('slave1'){ 
echo 'secondBranch' 
} 
} 

注:主人和SLAVE1是我的节点

什么是firstBranch和secondBranch理想????

控制台输出:

由用户匿名 [管道]发起者平行 [管道] [firstBranch] {(分公司:firstBranch) [管道] [secondBranch] {(分公司:secondBranch) [管道] [firstBranch]节点 [firstBranch]在/scratch/gnithyan/.hudson/workspace/pipeline_test运行在主
[管道] [secondBranch]节点
[管道] [secondBranch] //节点
[管道] [secondBranch]}
[secondBranch]无法在分支secondBranch
[管道] [firstBranch] {
[管道] [firstBranch]回声
[firstBranch] firstBranch
[管道] [firstBranch]}
[管道] [firstBranch] //节点
[管道] [firstBranch]}
[管道] //平行
管道 [管道]结束

java.lang.IllegalStateException:无法启动写日志到 成品节点 org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode [ID = 8]在 org.jenkinsci.plugins.workflow.support.actions.LogActionImpl。(LogActionImpl.java:110) 在 org.jenkinsci.plugins.workflow.support.actions.LogActionImpl.stream(LogActionImpl.java:81) 在 org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:73) 在 有机.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:252) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:179)at org.jenkinsci.plugins.workflow .cps.DSL.invokeMethod(DSL.java:126)at org.jenkin sci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108) at groovy.lang.GroovyObject $ invokeMethod $ 0.call(Unknown Source)at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall( CallSiteArray.java:48)

+1

请格式化代码(删除HTML内容) – Jayan

+0

我刚开始得到这个在以前工作流水线脚本w /最新版本的詹金斯。还没有弄清楚堆栈转储意味着什么:-( – kenyee

+0

在下面的grovvy脚本中 1.什么是第一分支和第二分支表示 2.does主和奴隶1应始终是名称,如果可用节点上詹金斯?? grovvy脚本: 平行firstBranch:{ 节点( '主'){ 回声firstBranch' } },secondBranch:{ 节点( 'SLAVE1'){ 回声secondBranch' } } –

回答

0

对我来说,它看起来非常正确。我有我的交货定义为管道,它运作良好。今天,在将Jenkins从2.25更新到2.26后,我得到了同样的错误。降级到2.25并没有帮助,但也许是因为我已经更新了插件:(