詹金斯基于输入的连续交付管道跳过阶段
问题描述:
简化的管道如下所示:
1. build
2. unit test
3. deploy to dev
4. integration tests
5. deploy to prod
对于步骤5,我设置了Jenkins管道输入命令.我们不会在每次提交时都将产品部署到产品上,因此,如果我们中止所有这些工作,它将有大量的灰色版本.是否可以有一个跳过选项,以使构建仍可以显示为 green 蓝色?
For step #5 I've setup a Jenkins pipeline input command. We won't be deploying to prod on every commit so if we abort all those jobs it will have a big list of grey builds. Is it possible to have a skip option so the build can still be shown as green blue?
答
您不能这样做吗,无论您从输入中选择什么,它都会变成蓝色/绿色,然后您也可以根据它运行部署?
Can't you do something like this, it will be blue/green whatever you choose from input, and you can then run the deployment depending on it too?
def deployToProduction = true
try{
input 'Deploy to Production'
}catch(e){
deployToProduction = false
}
if(deployToProduction){
println "Deploying to production"
}