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

stage launches agent even when not required

XMLWordPrintable

      given the following pipeline, I would expect the "with NO agent" stage to trigger without any agent being launched. This is not the case, all stages are launched with an agent. This is specially a problem when I have an "input" step waiting for a user interaction in one of the stages defined.

      pipeline {
          agent any
          tools {
              jdk "Oracle JDK 1.8 (latest)"
          }    
          stages {
              stage ('with any agent 0') {
                  steps 
                      sh "java -version"
                  }
              }  
              stage ('with NO agent') {
                  agent none
                  steps {
                      sh "java -version"
                  }
              }
              stage ('with any agent 1') {
                  steps {
                      sh "java -version"
                  }
              }        
          }
      }
      

      This is also the case where "with NO agent" is the first stage in the pipeline.

      btw. I was only able to discover this because of JENKINS-42338 - I think it would also be a good idea to have the "stage" step print some info on which agent it actually runs.

            abayer Andrew Bayer
            imod Dominik Bartholdi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: