詹金斯基于输入的连续交付管道跳过阶段 [英] Jenkins continuous delivery pipeline skip stage based on input

查看:170
本文介绍了詹金斯基于输入的连续交付管道跳过阶段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简化的管道如下所示:

 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"
}

这篇关于詹金斯基于输入的连续交付管道跳过阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆