詹金斯动态舞台,没有特工

我有一条声明性管道,在一个阶段中创建一个脚本,在该脚本中使用if / else块进行一些验证,在一种情况下,我声明一个具有输入的阶段(我只希望该阶段可以执行在这种特殊情况下)问题是我希望输入不锁定,执行程序将等待用户输入,但是它在阶段中声明的代理中执行,是否有可能覆盖声明为none的代理?

以下是管道的简历:

pipeline{
    agent none
    stages{
        ...
        stage('branch-selector'){
            agent{
                label 'runner'
            }
            steps {
                script {
                    if (BRANCH_NAME.contains('feature')){
                        print "in branch feature"
                    }
                    if (BRANCH_NAME == 'develop'){
                        print "in branch develop"
                    }else if (BRANCH_NAME == 'release_candidate'){
                        print "in branch rc"


                        stage('Confirm deploy'){
                            milestone ordinal: 10,label: "Promote Aproval Milestone"
                            input message: "Are you sure you want to promote"   
                        }

                        stage('Deploy'){
                            print "Deploy"                  
                        }
                    }
                }
            }
        }
    }
}

最诚挚的问候

buyaomima 回答:詹金斯动态舞台,没有特工

我认为您可以使用:何时 https://jenkins.io/doc/book/pipeline/syntax/#when

因此,仅在满足条件时才执行步骤。不需要额外的魔法。

本文链接:https://www.f2er.com/3028741.html

大家都在问