2017-02-06 66 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文件从第一个作业复制到运行第二个作业的节点。然后让单元测试处理器运行第一个和第二个工作的结果。