詹金斯如何创建管道手动步骤 [英] Jenkins how to create pipeline manual step
问题描述
之前的Jenkins2我使用
这很好,但我想使用新的Jenkins管道,从groovy脚本生成(Jenkinsfile),创建手动步骤。
到目前为止,我想出了 input
jenkins step。
使用jenkinsfile脚本:
节点{
stage'Checkout'
//从存储库获取一些代码
stage'Build'
//运行构建
}
stage'deployment'
input'你批准部署吗?'
node {
//部署事物
}
但是,这等待用户输入,并指出构建未完成。我可以将超时添加到 input
,但这不会让我选择/触发构建并稍后部署它:
如何使用新的jenkins-pipeline与Build Pipeline Plugin一起获得与手动步骤/触发器相同/类似的结果? / p>
这是Jenkins管道功能IMO的巨大差距。由于管道是单一工作,因此绝对难以提供。一种解决方案可能是将工作空间归档为工件(tar和archive ** / *为'workspace.tar.gz'),然后让另一个管道复制工件并将其解压缩到新工作空间中。这允许第二条管道在前一个管道停止的地方进行拾取。当然,没有办法来确定第二条管道不可能在不按顺序执行或不止一次执行。这太糟糕了。交付管道插件真的在这里发光。您从视图执行新的管道 - 而不是第一份工作。无论如何 - 没有太多的答案 - 但它的路径我会尝试。编辑:这个插件看起来很有前途:
$ b
b $ b
Prior Jenkins2 I was using Build Pipeline Plugin to build and manually deploy application to server. Old configuration:
That works great, but I want to use new Jenkins pipeline, generated from groovy script (Jenkinsfile), to create manual step.
So far I came up with input
jenkins step.
Used jenkinsfile script:
node {
stage 'Checkout'
// Get some code from repository
stage 'Build'
// Run the build
}
stage 'deployment'
input 'Do you approve deployment?'
node {
//deploy things
}
But this waits for user input, noting that build is not completed. I could add timeout to input
, but this won't allow me to pick/trigger a build and deploy it later on:
How can I achive same/similiar result for manual step/trigger with new jenkins-pipeline as prior with Build Pipeline Plugin?
This is a huge gap in the Jenkins Pipeline capabilities IMO. Definitely hard to provide due to the fact that a pipeline is a single job. One solution might be to "archive" the workspace as an "artifact" (tar and archive **/* as 'workspace.tar.gz'), and then have another pipeline copy the artifact and and untar it into the new workspace. This allows the second pipeline to pickup where the previous one left off. Of course there is no way to gauentee that the second pipeline cannot be executed out of turn or more than once. Which is too bad. The Delivery Pipeline Plugin really shines here. You execute a new pipeline right from the view - instead of the first job. Anyway - not much of an answer - but its the path I'm going to try.
EDIT: This plugin looks promising:
https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/doc/PIPELINE_EXAMPLES.md
这篇关于詹金斯如何创建管道手动步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!