How to wait for user input in a Declarative Pipeline without blocking a heavyweight executor

前端 未结 5 818
执念已碎
执念已碎 2021-02-05 03:25

I\'m rebuilding an existing build pipeline as a jenkins declarative pipeline (multi-branch-pipeline) and have a problem handling build propagation.

After packaging and s

5条回答
  •  野性不改
    2021-02-05 03:58

    The OP's question was how to "wait for user input in a Declarative Pipeline without blocking ...". This doesn't seem possible. Attempts to use agent: none does not free the build executor in a Declarative pipeline.

    This:

    pipeline {
    agent none
    stages {
        stage('Build') {
            agent { label 'big-boi' }
            steps {
                echo 'Stubbed'
            }
        }
    
        stage('Prompt for deploy') {
            agent { label 'tiny' }
            steps {
                input 'Deploy this?'
            }
        }
    
        stage('Deploy') {
            agent { label 'big-boi' }
            steps {
                echo "Deploying"
                build job: 'deploy-to-higher-environment'
            }
        }
    }
    }
    

    ... when run, looks like this:

    ... and this:

提交回复
热议问题