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

Pipelines which need a node with a specific label do not proceed after adding label to a node

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major

      Summary
      Given a Declarative pipeline with a stage set to run on a node matching a particular label (in my case linux, if there is node connected, the Pipeline will pause as expected. Adding this label to a node should cause the job to proceed, but usually, the pipeline remains "stuck."

      I don't know if this is specific to declarative, so I'm happy to move it to some other component.

      Frequency of occurrence:
      Maybe 50% of the time. There's no pattern apparent yet as to when it happens, or how to reliably trigger it.

      Steps to recreate
      1. Set up a remote build agent to have a label of other.

      2. Create a Pipeline job, as in the below block. Note that the whole top level agent setting is for any, but there's a stage, called needs-a-labeled-agent, which relies on an agent matching the label linux:

      pipeline {
      
          agent any
      
          stages {
      
              stage('first-stage') {
                  steps {
                      echo "Hello from Declarative."
                      sh "mvn -version"
                      sh "for i in `seq 1 5`; do cat /dev/urandom | env LC_CTYPE=c tr -dc \'[:alpha:]\' | head -c 100; done"
                  }
              }
      
              stage ('needs-a-labeled-agent') {
                  agent {
                      label ("linux")
                  }
                  steps {
                      sh "whoami"
                  }
              }
      
              stage ('runs-on-any') {
                  steps {
                      echo "If we see this, we made it past the agent label thing"
                  }
              }
          } // end stages
          post {
              always {
                  echo "ALWAYS --> Runs all the time."
                  deleteDir()
              }
              success {
                  echo "SUCCESS --> Whatever we did, it worked. Yay!"
              }
              failure {
                  echo "FAILURE --> Failed. Womp womp."
              }
          }
      }
      

      3. Build this pipeline. It will get stuck at the needs-a-labeled-agent stage, which is expected, because we don't have an agent with that label.

      4. Go to the Configure page for your remote agent, and replace the other label with linux. It'll look like this when done:

      5. The pipeline build does not proceed. My expectation was that it would proceed - and I've seen it do so occasionally. But more frequently, it does not proceed.

      6. Hover over the build queue, and you'll see a tooltip stating "Waiting for the next available executor on agent-69. Waiting for 10 minutes."

      7. This can be recreated with a multibranch project as well - but the above described test case is way simpler to set up.

        1. screenshot-9.png
          screenshot-9.png
          881 kB
        2. screenshot-8.png
          screenshot-8.png
          461 kB
        3. screenshot-7.png
          screenshot-7.png
          523 kB
        4. screenshot-6.png
          screenshot-6.png
          531 kB
        5. screenshot-5.png
          screenshot-5.png
          440 kB
        6. screenshot-4.png
          screenshot-4.png
          866 kB
        7. screenshot-3.png
          screenshot-3.png
          449 kB
        8. screenshot-2.png
          screenshot-2.png
          438 kB
        9. screenshot-10.png
          screenshot-10.png
          546 kB
        10. screenshot-1.png
          screenshot-1.png
          438 kB
        11. image-2018-06-12-12-11-52-219.png
          image-2018-06-12-12-11-52-219.png
          460 kB
        12. image-2018-06-12-12-10-54-958.png
          image-2018-06-12-12-10-54-958.png
          494 kB

            kshultz Karl Shultz
            kshultz Karl Shultz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: