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

Node selection by label doesn't use latest data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None
    • Version 2.452.1

      In our environment we use labels to mark jenkins nodes as busy when they are part of a pipeline run. We want to block them for other pipelines so they can continue on their tasks for the current pipeline, even if they are idle for some time in between.

      In some cases it happens that the node selection gives us a wrong (meaning busy) agent when the label got updated by a different pipeline some seconds ago

      From the pipeline output it seems that the node selector by label has got data different from the getLabelString method (see attachment)

      Our expectation is that with the code below we only get executor nodes that, at the exact moment, do not have the 'used' label.

      Code example:

      node("${env.executor_label} && !(used)") {                                stage("refresh and Check Used label on node") {                             def currentNodeLabel = jenkins.model.Jenkins.getInstance().getNode("${node_name}").getLabelString()
      echo "Node ${node_name} has Labelstring ${currentNodeLabel}"  

            Unassigned Unassigned
            mduker52 Marcel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: