Node selection by label doesn't use latest data

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

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

            Assignee:
            Unassigned
            Reporter:
            Marcel
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: