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

NodeLabel parameter not working inside workflow

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • jenkins 1.643
      nodelabel parameter plugin 1.7
      workflow plugin 1.12

      1. Install the nodelabel parameter plugin, and workflow plugin
      2. create a workflow, with one string parameter (STRING_PARAM1), and one node parameter (NODE_PARAM1)
      3. create a workflow like this:
        node {
           echo STRING_PARAM1
           echo NODE_PARAM1
        }
        

      If you run this workflow, you will get an error:

      groovy.lang.MissingPropertyException: No such property: NODE_PARAM1 for class: WorkflowScript
      

      The problem is that the NodeLabel parameter plugin overrides buildEnvVars which was deprecated in Jenkins 1.344: see http://javadoc.jenkins-ci.org/hudson/model/ParameterValue.html#buildEnvVars%28hudson.model.AbstractBuild,%20java.util.Map%29

      It needs to override buildEnvironment(). This is similar to the problem in JENKINS-27718

          [JENKINS-32209] NodeLabel parameter not working inside workflow

          Craig Rodrigues added a comment - See fix: https://github.com/jenkinsci/nodelabelparameter-plugin/pull/10/commits

          Code changed in jenkins
          User: Craig Rodrigues
          Path:
          src/main/java/org/jvnet/jenkins/plugins/nodelabelparameter/LabelParameterValue.java
          http://jenkins-ci.org/commit/nodelabelparameter-plugin/c78a062db28ca9fecbae2c70c161e013dc4e34af
          Log:
          JENKINS-32209 Override ParameterValue.buildEnvironment()

          ParameterValue.buildEnvVars() is deprecated. This fix is needed
          for the workflow plugin.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Craig Rodrigues Path: src/main/java/org/jvnet/jenkins/plugins/nodelabelparameter/LabelParameterValue.java http://jenkins-ci.org/commit/nodelabelparameter-plugin/c78a062db28ca9fecbae2c70c161e013dc4e34af Log: JENKINS-32209 Override ParameterValue.buildEnvironment() ParameterValue.buildEnvVars() is deprecated. This fix is needed for the workflow plugin.

          released with 1.7.1

          Dominik Bartholdi added a comment - released with 1.7.1

            domi Dominik Bartholdi
            rodrigc Craig Rodrigues
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: