Please note: the question is based on the old, now called "scripted" pipeline format. When using "declarative pipelines", parallel blocks can be nested inside of stage blocks (see Parallel stages with Declarative Pipeline 1.2).與詹金斯工作流程/流水線並行運行的階段
我想知道如何並行步驟應該與詹金斯工作流程/管道插件,特別是如何工作。如何將它們與構建階段混合使用。我知道的一般模式:
parallel(firstTask: {
// Do some stuff
}, secondTask: {
// Do some other stuff in parallel
})
不過,我想在並行運行幾個階段(在同一個節點,其中有多個執行人),因此我嘗試添加階段是這樣的:
stage 'A'
// Do some preparation stuff
parallel(firstTask: {
stage 'B1'
// Do some stuff
}, secondTask: {
stage 'B2'
// Do some other stuff in parallel
})
stage 'C'
// Finalizing stuff
這不起作用。 「do stuff」任務是並行執行的,但並行階段立即結束,不包含他們應該包含的內容。因此,Stage View不會顯示正確的結果,也不會鏈接日誌。
我可以並行構建不同的階段,還是僅在單個階段內使用「並行」步驟?
什麼exaclty不起作用?我在幾分鐘前在Jenkins試過了你的代碼片段,它似乎工作得很好。 –
正如我所說的,工作步驟並非真正作爲階段的一部分,即階段視圖不顯示花費的時間,也沒有日誌。如果你不平行地做同樣的步驟,你會看到不同之處。 – ami
我明白了 - 所以這個問題只能在舞臺視圖中看到,對吧? –