Pipelineプラグインで概念証明をしていて、ビルドを並行して実行する方法を見たいと思います。実行するビルドのリストは非常に動的です。特定のハードウェアの設定。だから、私はブランチを動的に作成しようとしました。しかし、ハードコードされたインデックスをブランチのマップに追加すれば、すべて正常に動作します。それはジェンキンス事やグルーヴィーなものになるかもしれませんねだから私は、(私は、Javaとかなり良いですが)グルーヴィーで初心者だ - 私は本当に、出力は次のようになりループで作成したときにブランチが正しく実行されない
def branchesFail = [:]
for (int i = 0; i < 5; i++) {
s = i.toString()
branchesFail [ s ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: s ] ] }
}
parallel branchesFail
def branchesPass = [:]
branchesPass [ '0' ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: '0' ] ] }
branchesPass [ '1' ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: '1' ] ] }
branchesPass [ '2' ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: '2' ] ] }
branchesPass [ '3' ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: '3' ] ] }
branchesPass [ '4' ] = { build job: 'nebraska-echo', parameters: [ [$class: 'StringParameterValue', name: 'ARG', value: '4' ] ] }
parallel branchesPass
を知らない:
[Pipeline] Execute sub-workflows in parallel : Start
[Pipeline] [0] parallel {: Parallel branch: 0
[Pipeline] [1] parallel {: Parallel branch: 1
[Pipeline] [2] parallel {: Parallel branch: 2
[Pipeline] [3] parallel {: Parallel branch: 3
[Pipeline] [4] parallel {: Parallel branch: 4
[Pipeline] [0] build: Building nebraska-echo
[0] Scheduling project: nebraska-echo
[Pipeline] [1] build: Building nebraska-echo
[1] Scheduling project: nebraska-echo
[Pipeline] [2] build: Building nebraska-echo
[2] Scheduling project: nebraska-echo
[Pipeline] [3] build: Building nebraska-echo
[3] Scheduling project: nebraska-echo
[Pipeline] [4] build: Building nebraska-echo
[4] Scheduling project: nebraska-echo
[0] Starting building: nebraska-echo #58
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] Execute sub-workflows in parallel : End
[Pipeline] Execute sub-workflows in parallel : Start
[Pipeline] [0] parallel {: Parallel branch: 0
[Pipeline] [1] parallel {: Parallel branch: 1
[Pipeline] [2] parallel {: Parallel branch: 2
[Pipeline] [3] parallel {: Parallel branch: 3
[Pipeline] [4] parallel {: Parallel branch: 4
[Pipeline] [0] build: Building nebraska-echo
[0] Scheduling project: nebraska-echo
[Pipeline] [1] build: Building nebraska-echo
[1] Scheduling project: nebraska-echo
[Pipeline] [2] build: Building nebraska-echo
[2] Scheduling project: nebraska-echo
[Pipeline] [3] build: Building nebraska-echo
[3] Scheduling project: nebraska-echo
[Pipeline] [4] build: Building nebraska-echo
[4] Scheduling project: nebraska-echo
[0] Starting building: nebraska-echo #59
[1] Starting building: nebraska-echo #60
[2] Starting building: nebraska-echo #61
[3] Starting building: nebraska-echo #62
[4] Starting building: nebraska-echo #63
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] } //parallel
[Pipeline] Execute sub-workflows in parallel : End
[Pipeline] End of Pipeline
Finished: SUCCESS
ループ内に追加されたブランチからは、最初に実行されます(branchesFail内の項目数に関係なく)が、ブランチパスではすべてのジョブが期待通りに実行されます。
私は間違っていますか?
マーク。