【发布时间】:2020-05-05 02:37:34
【问题描述】:
我们的目标是用多个代理划分我们的管道。
我们有一个叫 slave1 的奴隶,它的唯一目的是在 git 上结帐, 并构建可执行文件。
最终当 slave1 完成时,我们想将它的输出传递给 slave2, 它的唯一目的是测试 slave1 的可执行文件。
请注意,这里的想法不是拆分工作,而是实现 同一管道中的文件。
这是一个更有意义的Jenkinsfile 示例:
pipeline
{
agent
{
label 'slave1'
}
stages
{
stage("Initialize & Build")
{
steps
{
script
{
println("Im starting the pipeline with slave1!")
// Builds Files
// ....
// Has many files that needs to pass to slave2
}
}
}
stage("Execute & Test")
{
agent
{
label 'slave2'
}
steps
{
script
{
println("Im in the new slave - slave2!")
// How does this slave get the files?
}
}
}
}
}
如何在代理之间传递这些文件?
我阅读了有关工件的信息,但它的目标似乎是从作业中返回对象,这不一定是需要的。
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-groovy