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

Block-scoped "wrapper" options for individual stages

    XMLWordPrintable

Details

    • Pipeline - December

    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

            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.

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

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

            Releasing in 1.2.6.

            abayer Andrew Bayer added a comment - Releasing in 1.2.6.

            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

            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

            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

            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
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

            People

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

              Dates

                Created:
                Updated:
                Resolved: