英文:
Jenkins - Dir into another job's workspace to execute script
问题
I have a pipeline that builds two Jenkins in parallel:
try {
parallel (
a: {
script { build_a = build(job: "...", parameters: [...]) }
},
b: {
script { build_b = build(job: "...", parameters: [...]) }
},
)
}
The two jobs will do a full checkout of several repos, and then build. If both succeed I want to tag the HEAD of all those repos.
For that I would need to go to both build_a and build_b 's workspace and execute the git tag commands from there.
Is this possible?
Alternatively, I would need to do an added two full checkouts in the parent job in order to tag them after the two jobs succeed.
I tried looking in the documentation but it doesn't seem possible.
英文:
I have a pipeline that builds two Jenkins in parallel:
try {
parallel (
a: {
script { build_a = build(job: "...", parameters: [...]) }
},
b: {
script { build_b = build(job: "...", parameters: [...]) }
},
)
}
The two jobs will do a full checkout of several repos, and then build. If both succeed I want to tag the HEAD of all those repos.
For that I would need to go to both build_a and build_b 's workspace and execute the git tag commands from there.
Is this possible?
Alternatively, I would need to do an added two full checkouts in the parent job in order to tag them after the two jobs succeed.
I tried looking in the documentation but it doesn't seem possible.
答案1
得分: 1
一般来说,你不能假设工作空间在任务完成后会保留下来。这就是为什么 Jenkins 没有任何用于访问它们的命令。你可以通过 API 调用来创建一个标签吗?GitHub 有一个API可以实现这个,我相信其他提供商也有。
英文:
Generally speaking, you can't assume that the workspaces persist after the jobs have completed. That's why Jenkins doesn't have any commands for accessing them. Can you do an API call to create a tag? GitHub has an API for that, I'm sure other providers do too.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论