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

Block-scoped "wrapper" options for individual stages

    XMLWordPrintable

    Details

    • Sprint:
      Pipeline - December
    • Similar Issues:

      Description

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

        Attachments

          Issue Links

            Activity

            Hide
            abayer 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.

            Show
            abayer 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.
            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/230 - this is on top of the change for JENKINS-46809, so the PR has a bunch of commits in it at the moment.

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/230 - this is on top of the change for JENKINS-46809 , so the PR has a bunch of commits in it at the moment.
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - Redid as https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/231 , not on top of any other PR.
            Hide
            abayer Andrew Bayer added a comment -

            Releasing in 1.2.6.

            Show
            abayer Andrew Bayer added a comment - Releasing in 1.2.6.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            content/doc/book/pipeline/syntax.adoc
            http://jenkins-ci.org/commit/jenkins.io/9bb7d02cfb1acf4adf6d0b6e5697fb73a7419fee
            Log:
            [JENKINS-48379, JENKINS-48380] Adding options and input for stage

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: content/doc/book/pipeline/syntax.adoc http://jenkins-ci.org/commit/jenkins.io/9bb7d02cfb1acf4adf6d0b6e5697fb73a7419fee Log: [JENKINS-48379, JENKINS-48380] Adding options and input for stage
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Liam Newman
            Path:
            content/doc/book/pipeline/syntax.adoc
            http://jenkins-ci.org/commit/jenkins.io/ff40d07092a3d05253dab6537270961e0a3b3140
            Log:
            Merge pull request #1288 from abayer/jenkins-48379-48380

            [JENKINS-48379, JENKINS-48380] Adding options and input for stage

            Compare: https://github.com/jenkins-infra/jenkins.io/compare/f93ba1caaf9a...ff40d07092a3

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Liam Newman Path: content/doc/book/pipeline/syntax.adoc http://jenkins-ci.org/commit/jenkins.io/ff40d07092a3d05253dab6537270961e0a3b3140 Log: Merge pull request #1288 from abayer/jenkins-48379-48380 [JENKINS-48379, JENKINS-48380] Adding options and input for stage Compare: https://github.com/jenkins-infra/jenkins.io/compare/f93ba1caaf9a...ff40d07092a3

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                jamesdumay James Dumay
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: