gpt4 book ai didi

Jenkins如何创建管道手动步骤

转载 作者:行者123 更新时间:2023-12-03 06:03:23 24 4
gpt4 key购买 nike

我之前使用的 Jenkins2 Build Pipeline Plugin构建应用程序并将其手动部署到服务器。旧配置: jenkins-pipeline-plugin

效果很好,但我想使用从 groovy 脚本(Jenkinsfile)生成的新 Jenkins 管道来创建手动步骤。

到目前为止,我想出了input jenkins 步骤。

使用的 jenkinsfile 脚本:

node {
stage 'Checkout'
// Get some code from repository

stage 'Build'
// Run the build
}

stage 'deployment'
input 'Do you approve deployment?'
node {
//deploy things
}

但这会等待用户输入,并指出构建尚未完成。我可以向 input 添加超时,但这不允许我选择/触发构建并稍后部署它:

jenkins-pipeline

如何使用新的 jenkins-pipeline 实现与之前使用构建管道插件相同/相似的手动步骤/触发结果?

最佳答案

在我看来,这是 Jenkins Pipeline 功能的巨大差距。由于管道是一项单一工作,因此绝对很难提供。一种解决方案可能是将工作区“归档”为“工件”(tar 并将 **/* 归档为“workspace.tar.gz”),然后让另一个管道复制该工件并将其解压到新工作区中。这允许第二条管道从前一条管道停止的地方继续。当然,没有办法保证第二个管道不能不按顺序执行或多次执行。这太糟糕了。交付管道插件在这里确实大放异彩。您可以直接从 View 执行新的管道,而不是第一个作业。无论如何 - 没有太多答案 - 但这是我要尝试的道路。

编辑:这个插件看起来很有前途:

https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/doc/PIPELINE_EXAMPLES.md

关于Jenkins如何创建管道手动步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39913886/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com