从詹金斯的另一个工作中获取测试结果
Obtaining test results from another job in jenkins
我有一个看起来像这样的 Jenkins 管道 A
- 运行 预构建测试
- 构建项目
- 运行 post-构建测试
- 运行 另一个管道 B,其参数从当前构建中提取
我想知道是否有办法从管道 B 获取测试结果并将它们与管道 A 的测试结果汇总。
目前,我必须打开控制台输出并打开 Url 到外部构建。
如果以上不可能,是否可以在控制台以外的其他地方显示此 Url(例如作为工件)。
我相信你要找的是"stash"。下面是直接从https://jenkins.io/doc/pipeline/examples/
复制过来的
Synopsis
This is a simple demonstration of how to unstash to a different directory than the root directory, so that you can make sure not to overwrite directories or files, etc.
// 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 由 运行ning 单元测试产生的文件,从第一个作业到节点 运行ning 第二个作业。然后让单元测试处理器 运行 处理第一个和第二个作业的结果。
我有一个看起来像这样的 Jenkins 管道 A
- 运行 预构建测试
- 构建项目
- 运行 post-构建测试
- 运行 另一个管道 B,其参数从当前构建中提取
我想知道是否有办法从管道 B 获取测试结果并将它们与管道 A 的测试结果汇总。 目前,我必须打开控制台输出并打开 Url 到外部构建。
如果以上不可能,是否可以在控制台以外的其他地方显示此 Url(例如作为工件)。
我相信你要找的是"stash"。下面是直接从https://jenkins.io/doc/pipeline/examples/
复制过来的Synopsis This is a simple demonstration of how to unstash to a different directory than the root directory, so that you can make sure not to overwrite directories or files, etc.
// 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 由 运行ning 单元测试产生的文件,从第一个作业到节点 运行ning 第二个作业。然后让单元测试处理器 运行 处理第一个和第二个作业的结果。