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

Jenkins ToolInstaller appliesTo(Node node) doesn't consider assigned labels

XMLWordPrintable

    • 2287.va_d728a_42d7f1

      Hi,

      Took me a while to understand why tools were not installed on running agent even if the labels were set on the node.

      I happen that the https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tools/ToolInstaller.java#L87 doesn't consider assigned labels (Typically the ones created by LabelFinder extensions). Like https://github.com/jenkinsci/platformlabeler-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/platformlabeler/PlatformLabeler.java#L40

      It's specially true of ephemeral agent and tool directive installation. Dynamic labels are assigned "too late" on the build.

      I propose to change it to (not tested)

      public boolean appliesTo(Node node) {
         Label l = Jenkins.get().getLabel(label);
         return l == null || node.getAssignedLabels().contains(l);
      }
      

       

      Any thought ?

            jonesbusy Valentin Delaye
            jonesbusy Valentin Delaye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: