2017-02-06 115 views
0

我有詹金斯管道上,看起來像這樣獲得測試結果

  • 運行預生成測試
  • 構建項目
  • 運行後生成測試
  • 運行另一個管道B從當前版本中提取參數

我想知道是否有方法從管道B獲取測試結果並將它們與流水線A的測試結果彙總在一起。 目前,我必須打開控制檯輸出並打開外部構建的Url。

如果以上是不可能的,是否有可能在控制檯以外的地方顯示此Url(例如作爲工件)。

+0

您可以將輸出寫入文件,否則您的結果可能會被覆蓋 – utkusonmez

回答

1

我相信你在找什麼是「隱藏」。下面是直接從https://jenkins.io/doc/pipeline/examples/

簡介 複製這是如何unstash到不同的目錄的根目錄下,這樣就可以確保不會覆蓋目錄或文件的簡單演示等

// First we'll generate a text file in a subdirectory on one node and stash it. 
stage "first step on first node" 

// Run on a node with the "first-node" label. 
node('first-node') { 
    // Make the output directory. 
    sh "mkdir -p output" 

    // Write a text file there. 
    writeFile file: "output/somefile", text: "Hey look, some text." 

    // Stash that directory and file. 
    // Note that the includes could be "output/", "output/*" as below, or even 
    // "output/**/*" - it all works out basically the same. 
    stash name: "first-stash", includes: "output/*" 
} 

// Next, we'll make a new directory on a second node, and unstash the original 
// into that new directory, rather than into the root of the build. 
stage "second step on second node" 

// Run on a node with the "second-node" label. 
node('second-node') { 
    // Run the unstash from within that directory! 
    dir("first-stash") { 
     unstash "first-stash" 
    } 

    // Look, no output directory under the root! 
    // pwd() outputs the current directory Pipeline is running in. 
    sh "ls -la ${pwd()}" 

    // And look, output directory is there under first-stash! 
    sh "ls -la ${pwd()}/first-stash" 
} 

基本上,您可以將運行單元測試所產生的.xml文件從第一個作業複製到運行第二個作業的節點。然後讓單元測試處理器運行第一個和第二個工作的結果。