我有一个看起来像这样的Jenkins管道
我想知道是否有办法从管道B获取测试结果并将它们与管道A的测试结果聚合在一起。 目前,我必须打开控制台输出并打开Url到外部版本。
如果无法实现上述目标,是否可以在控制台以外的其他位置显示此Url(例如,作为工件)。
答案 0 :(得分:2)
我相信你所寻找的是“藏匿”。以下内容直接从https://jenkins.io/doc/pipeline/examples/
复制概要 这是一个简单的演示,说明如何卸载到根目录以外的其他目录,这样就可以确保不会覆盖目录或文件等。
// 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文件)从第一个作业复制到运行第二个作业的节点。然后让Unit测试处理器同时运行第一个和第二个作业的结果。