Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48380

Block-scoped "wrapper" options for individual stages

    • Pipeline - December

      Problem
      In Declarative it is not possible to wrap a timeout out side of a stage and not have it utilise the agent.

      stage('Continue deploy') {
        agent none
        steps {
          timeout(time: 1, unit: 'DAYS') {
            input 'Continue deploy?'
          }
        }
      }
      stage('deploy') {
        agent { label 'deployer' }
        steps {
          echo 'deploy'
        }
      }
      

      Solution
      It would be great if we could have something like the following (assuming JENKINS-48379)

      stage('deploy') {
        timeout {
          time: 1
          unit: DAYS
        }
        input {
          input 'Continue deploy?'
        }
        steps {
          echo 'deploy'
        }
      }
      

          [JENKINS-48380] Block-scoped "wrapper" options for individual stages

          James Dumay created issue -
          James Dumay made changes -
          Epic Link New: JENKINS-48356 [ 186951 ]
          James Dumay made changes -
          Description Original: *Problem*
          In Declarative it is not possible to wrap a timeout out side of a stage and not have it utilise the agent.

          {code}
          stage('cancel deploy') {
            agent none
            steps {
              timeout(time: 1, unit: 'DAYS') {
                input 'Cancel deploy?'
              }
            }
          }
          stage('deploy') {
            agent { label 'deployer' }
            steps {
              echo 'deploy'
            }
          }
          {code}

          *Solution*
          It would be great if we could have something like the following (assuming JENKINS-48379)

          {code}
          stage('deploy') {
            timeout {
              time: 1
              unit: DAYS
            }
            input {
              input 'Cancel deploy?'
            }
            steps {
              echo 'deploy'
            }
          }
          {code}
          New: *Problem*
          In Declarative it is not possible to wrap a timeout out side of a stage and not have it utilise the agent.

          {code}
          stage('Continue deploy') {
            agent none
            steps {
              timeout(time: 1, unit: 'DAYS') {
                input 'Continue deploy?'
              }
            }
          }
          stage('deploy') {
            agent { label 'deployer' }
            steps {
              echo 'deploy'
            }
          }
          {code}

          *Solution*
          It would be great if we could have something like the following (assuming JENKINS-48379)

          {code}
          stage('deploy') {
            timeout {
              time: 1
              unit: DAYS
            }
            input {
              input 'Continue deploy?'
            }
            steps {
              echo 'deploy'
            }
          }
          {code}

          Andrew Bayer added a comment -

          Linking this to JENKINS-48379 - what we need here is something like options at the top level, a container for steps that wrap the entire stage or run before the stage body gets going. This does get a bit hairier for the input sort of case, because that’d always execute before when gets evaluated, but we’ve made the decision that agent precedes when (because one of the two has to be first, and the hassle from getting the agent is less of a problem than the limitations resulting from not being able to do anything on the agent for a when condition) so that’s just how the cookie crumbles, as it were.

          Andrew Bayer added a comment - Linking this to JENKINS-48379 - what we need here is something like options at the top level, a container for steps that wrap the entire stage or run before the stage body gets going. This does get a bit hairier for the input sort of case, because that’d always execute before when gets evaluated, but we’ve made the decision that agent precedes when (because one of the two has to be first, and the hassle from getting the agent is less of a problem than the limitations resulting from not being able to do anything on the agent for a when condition) so that’s just how the cookie crumbles, as it were.
          Andrew Bayer made changes -
          Link New: This issue relates to JENKINS-48379 [ JENKINS-48379 ]
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal CD-366 (Web Link)" [ 18943 ]
          Andrew Bayer made changes -
          Summary Original: Timeout for stage New: Block-scoped "wrapper" options for individual stages
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-43336 [ JENKINS-43336 ]
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Sprint Original: Pipeline - Candidates [ 381 ] New: Pipeline - December [ 446 ]

            abayer Andrew Bayer
            jamesdumay James Dumay
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: