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

Fail to set reference parameters with different type of drop down list

      We use the node label parameter plugin to pass the name of the node selected to plugin "Active Choices Plugin" t but when I use ${NODE_NAME} as reference parameters, it didn't work, I did try with name "nodes" of Node definition. it didn't work neither.

        1. screenshot-1.png
          screenshot-1.png
          12 kB
        2. screenshot-2.png
          screenshot-2.png
          26 kB
        3. screenshot-3.png
          screenshot-3.png
          58 kB
        4. screenshot-4.png
          screenshot-4.png
          56 kB
        5. screenshot-5.png
          screenshot-5.png
          8 kB

          [JENKINS-38105] Fail to set reference parameters with different type of drop down list

          It looks like the component is wrong. It is not active directory plugin, but Active Choices Plugin?

          Félix Belzunce Arcos added a comment - It looks like the component is wrong. It is not active directory plugin, but Active Choices Plugin?

          Yang Li added a comment -

          Steps reproduce the issue:

          1. install NodeLabel Parameter Plugin - https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin
          2. create new Nodes, see screenshot-1 ,2
          3. set up node for a drop down list see screenshot-3:
          4. write scripts and set reference parameters "test_nodes", then we expected the radio change based on selection of drop down list. see screenshot-4:
          groovy code:

          if (test_nodes.contains("node_1")) {
            return ["sanity_1"]
          } else if (test_nodes.contains("node_2")) {
            return ["sanity_2"]
          } else if (test_nodes.contains("node_3")) {
            return ["regression_1"]
          } else if (test_nodes.contains("node_4")) {
            return ["regression_2"]
          } else  if (test_nodes.contains("node_5")) {
            return ["performance"]
          }else if( test_nodes == "" ) {
            return ["empty"]
          } else {
            return ["unknown"]
          }
          

          5. Build with Parameters page select node from test_nodes ddl,
          Expected behavior:
          Device_Attached radio should be change.

          Actual behavior:
          Device_Attached radio wasn't change. as the reference parameters is empty.

          Yang Li added a comment - Steps reproduce the issue: 1. install NodeLabel Parameter Plugin - https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin 2. create new Nodes, see screenshot-1 ,2 3. set up node for a drop down list see screenshot-3: 4. write scripts and set reference parameters "test_nodes", then we expected the radio change based on selection of drop down list. see screenshot-4: groovy code: if (test_nodes.contains( "node_1" )) { return [ "sanity_1" ] } else if (test_nodes.contains( "node_2" )) { return [ "sanity_2" ] } else if (test_nodes.contains( "node_3" )) { return [ "regression_1" ] } else if (test_nodes.contains( "node_4" )) { return [ "regression_2" ] } else if (test_nodes.contains( "node_5" )) { return [ "performance" ] } else if ( test_nodes == "" ) { return [ "empty" ] } else { return [ "unknown" ] } 5. Build with Parameters page select node from test_nodes ddl, Expected behavior: Device_Attached radio should be change. Actual behavior: Device_Attached radio wasn't change. as the reference parameters is empty.

          Successfully reproduced the issue. After debugging the Java and JavaScript code, I believe I found the reason why the NodeLabel parameter plug-in is not compatible with Active Choices.

          Here's what the Choice Parameter drop down source code looks like.

          <div name="parameter">
            <input name="name" value="CCC" type="hidden">
            <select name="value"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></div>
          

          There's a parameter DIV, followed by a name INPUT, and a value SELECT. Now here's what the Active Choices Choices drop down looks like.

          <div id="choice-parameter-13064023878829" description="" name="parameter">
            <input name="name" value="PARAM000" type="hidden">
            <select name="value"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></div>
          

          Again, a parameter DIV, followed by a name INPUT, and a value SELECT. Now, here's the NodeLabel drop down source code.

          <div description="" name="parameter">
            <input name="name" value="NODES_PARAM" type="hidden">
            <select name="labels"><option value="master">master</option><option value="manga">manga</option><option value="test1">test1</option></select></div>
          

          The problem is that the Active Choices plugin follows a simple logic, where is tries to match the "Referenced Parameter Name" (IOW the name of the parameter that we want to grab the value) against the HTML element which name is value. As NodeLabel parameter does not have an HTML element with that name, active choices is not able to understand that it needs to use that HTML element.

          Bruno P. Kinoshita added a comment - Successfully reproduced the issue. After debugging the Java and JavaScript code, I believe I found the reason why the NodeLabel parameter plug-in is not compatible with Active Choices. Here's what the Choice Parameter drop down source code looks like. <div name= "parameter" > <input name= "name" value= "CCC" type= "hidden" > <select name= "value" ><option value= "1" >1</option><option value= "2" >2</option><option value= "3" >3</option><option value= "4" >4</option></select></div> There's a parameter DIV, followed by a name INPUT, and a value SELECT. Now here's what the Active Choices Choices drop down looks like. <div id= "choice-parameter-13064023878829" description= "" name=" parameter"> <input name= "name" value= "PARAM000" type= "hidden" > <select name= "value" ><option value= "1" >1</option><option value= "2" >2</option><option value= "3" >3</option><option value= "4" >4</option></select></div> Again, a parameter DIV, followed by a name INPUT, and a value SELECT. Now, here's the NodeLabel drop down source code. <div description= "" name=" parameter"> <input name= "name" value= "NODES_PARAM" type= "hidden" > <select name= "labels" ><option value= "master" >master</option><option value= "manga" >manga</option><option value= "test1" >test1</option></select></div> The problem is that the Active Choices plugin follows a simple logic, where is tries to match the "Referenced Parameter Name" (IOW the name of the parameter that we want to grab the value) against the HTML element which name is value. As NodeLabel parameter does not have an HTML element with that name, active choices is not able to understand that it needs to use that HTML element.

          Pull request created against NodeLabel parameter https://github.com/jenkinsci/nodelabelparameter-plugin/pull/12

          Bruno P. Kinoshita added a comment - Pull request created against NodeLabel parameter https://github.com/jenkinsci/nodelabelparameter-plugin/pull/12

          Pull request merged in NodeLabel parameter version 1.7.3. Can you try it again, please, yang928? Resolving the issue, but will close after you've confirmed it's gone.

          Bruno P. Kinoshita added a comment - Pull request merged in NodeLabel parameter version 1.7.3. Can you try it again, please, yang928 ? Resolving the issue, but will close after you've confirmed it's gone.

          Yang Li added a comment -

          will do, as long as 1.7.3 is released and available.

          Yang Li added a comment - will do, as long as 1.7.3 is released and available.

          Hmmm, weird. Went to update center JSON to take a look, and nodelabel parameter 1.7.3 is not out, though I can see the tag has been created in GitHub. I think we will have to wait a bit more.

          Bruno P. Kinoshita added a comment - Hmmm, weird. Went to update center JSON to take a look, and nodelabel parameter 1.7.3 is not out, though I can see the tag has been created in GitHub. I think we will have to wait a bit more.

          Sergej Kleva added a comment -

          Any news on this? 

          I am having the exact problem!

           

          Thanks guys!

          Sergej Kleva added a comment - Any news on this?  I am having the exact problem!   Thanks guys!

          Zviki K added a comment -

          The problem still exists.
          How can I take and create my own plug-in from the sources, I need to work with slaves and active choice plug-in?

          Thanks.

          Zviki K added a comment - The problem still exists. How can I take and create my own plug-in from the sources, I need to work with slaves and active choice plug-in? Thanks.

          Zviki K added a comment -

          Node and label plug-in 1.7.3 is not released yet.

          Zviki K added a comment - Node and label plug-in 1.7.3 is not released yet.

            kinow Bruno P. Kinoshita
            yang928 Yang Li
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: