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

Active Choices Reactive Reference Parameter is not referring Boolean parameter in Jenkins

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • active-choices-plugin
    • None
    • 2.335+. Jenkins. Linux

      'm using Jenkins for the release processes. In a freestyle project, I need to show 'To Mail Id' input box to get mail ids to send mail only when 'Send Mail' check box should be checked. For the requirement, I am using 'Formatted HTML' in 'Active Choices Reactive Reference Parameter' to display 'To Mail Id' input box and 'Boolean Parameter' to display the 'Send Mail' check box. And I am referring 'Send Mail' boolean parameter name in 'Referenced parameters' of 'To Mail Id'-'Active Choices Reactive Reference Parameter'. Using groovy script, based on the boolean parameter, the mail id input text is displayed.

      The issue is that the 'Boolean Parameter' check and uncheck switching is not reflecting in 'Active Choices Reactive Reference Parameter'. How to resolve the same?

      Groovy Script used in 'Active Choices Reactive Reference Parameter'
       
      {{def sendMail = SEND_MAIL;
      if (sendMail.equals('on'))

      { html_to_be_rendered = """<table><tr><td><label>TO_MAIL_ID</label></td><td><input type="text" class="setting-input" name="value" size="70" id="to_mail_id"><small>Enter To Mail ID.This is a comma separated list (optional white space after commas) of mail IDs that should receive mails. E.g., ram@example.com, varun@example.com.</small></td></tr></table>""" return html_to_be_rendered }

      else {
      html_to_be_rendered =""
      return html_to_be_rendered
      }}}

      Screenshot #1 - Send Mail Boolean Parameter

      Screenshot #2 - To Mail Id Active Choices Reactive Reference Parameter

        1. diff_parameter_334.txt
          0.2 kB
        2. diff_parameter_335.txt
          0.2 kB
        3. form_334.JPG
          form_334.JPG
          34 kB
        4. form_335.JPG
          form_335.JPG
          36 kB

          [JENKINS-68013] Active Choices Reactive Reference Parameter is not referring Boolean parameter in Jenkins

          Jeremy Cooper added a comment -

          This issue appears to only be impacting booleanParam references

          Jeremy Cooper added a comment - This issue appears to only be impacting booleanParam references

          Believe this is the same as what I reported-> https://issues.jenkins.io/browse/JENKINS-68012

          Krzysztof Mulica added a comment - Believe this is the same as what I reported->  https://issues.jenkins.io/browse/JENKINS-68012

          orzech szek added a comment -

          Any progress ? The same issue with Jenkins version 2.339.

          orzech szek added a comment - Any progress ? The same issue with Jenkins version  2.339.

          Jeremy Cooper added a comment - - edited

          Hi there!

          This issue is persisting in 2.340 as well.  The issue is blocking all consumption of Jenkins releases since version 2.335.  

          Please advise?

          Jeremy Cooper added a comment - - edited Hi there! This issue is persisting in  2.340 as well.  The issue is blocking all consumption of Jenkins releases since version 2.335.   Please advise?

          No progress yet, sorry, busy with $work/life/other sponsored projects.

          If anyone has a pull request with the fix I can quickly review & release a new version. If it's blocking an installation, it should be possible to check with CloudBees (or other consulting companies) to work on a fix for this issue. Although if anyone has some Java & Jenkins plug-in experience, it shouldn't be too difficult to fix it (I guess the hardest part if finding what the plug-in is doing, probably the HTML structure that changed, and updating the Java or JavaScript code to fetch the parameter value by navigating DOM/classes/attributes.)

          Bruno P. Kinoshita added a comment - No progress yet, sorry, busy with $work/life/other sponsored projects. If anyone has a pull request with the fix I can quickly review & release a new version. If it's blocking an installation, it should be possible to check with CloudBees (or other consulting companies) to work on a fix for this issue. Although if anyone has some Java & Jenkins plug-in experience, it shouldn't be too difficult to fix it (I guess the hardest part if finding what the plug-in is doing, probably the HTML structure that changed, and updating the Java or JavaScript code to fetch the parameter value by navigating DOM/classes/attributes.)

          Jonas Hommel added a comment -

          same here on jenkins 2.339. cannot use boolean parameters in Active Choices Reactive Reference Parameter

          Jonas Hommel added a comment - same here on jenkins 2.339. cannot use boolean parameters in Active Choices Reactive Reference Parameter

          Jeremy Cooper added a comment -

          Wanted to check in on this issue?   its still blocking consumption of Jenkins updates since version 2.335.

           

          Thanks

          Jeremy

          Jeremy Cooper added a comment - Wanted to check in on this issue?   its still blocking consumption of Jenkins updates since version 2.335.   Thanks Jeremy

          orzech szek added a comment -

          It's really impacting many processes. Please verify when possible.

          orzech szek added a comment - It's really impacting many processes. Please verify when possible.

          Hi,

          I'm still busy with $work, and working on sponsored projects. If anyone has time to fix the issue and send a pull request, I can merge and release it during a lunch break. Otherwise, please remember this plug-in is maintained by volunteer, it is not sponsored, and I am not even using it at the moment (currently using a mix of Buildkite and GH Actions for current projects).

          If anyone needs this fixed ASAP, please hire a consulting company (e.g. Cloudbees offers this kind of support).

          Bruno

          Bruno P. Kinoshita added a comment - Hi, I'm still busy with $work, and working on sponsored projects. If anyone has time to fix the issue and send a pull request, I can merge and release it during a lunch break. Otherwise, please remember this plug-in is maintained by volunteer, it is not sponsored, and I am not even using it at the moment (currently using a mix of Buildkite and GH Actions for current projects). If anyone needs this fixed ASAP, please hire a consulting company (e.g. Cloudbees offers this kind of support). Bruno

          Jonas Hommel added a comment -

          Hi folks,

          unfortunately I'm neither a jenkins developer, nor a jenkins plugin developer, but i tried to investigate that issue a little.

          And where did i ended? In a working plugin. As stated in the linked ticket JENKINS-68012, the issue seems not to be related to the plugin itself, but to the jenkins version (was caused by an update).

          The local Jenkins was Jenkins 2.263.1 which seems to be an older LTS version. Current LTS version is Jenkins 2.332.3 and our Jenkins is running on Jenkins 2.263.1 meanwhile and still not working.

          Tried to reproduce with local Jenkins 2.334 -> working
          Tried to reproduce with local Jenkins 2.335 -> Not working, as expected

          (Needed to add/update some dependency versions for doing that in the plugin pom.)

          Any hints on where to have a closer look now?

          Will try to determine the changes between Jenkins 2.334 and Jenkins 2.335 now.

           

          Kind regards

          Jonas

           

          Jonas Hommel added a comment - Hi folks, unfortunately I'm neither a jenkins developer, nor a jenkins plugin developer, but i tried to investigate that issue a little. I've cloned the plugin code from github imported to eclipse launched the plugin with the built in/ local jenkins as described there: https://www.jenkins.io/doc/developer/tutorial/run/ And where did i ended? In a working plugin. As stated in the linked ticket JENKINS-68012 , the issue seems not to be related to the plugin itself, but to the jenkins version (was caused by an update). The local Jenkins was Jenkins 2.263.1 which seems to be an older LTS version. Current LTS version is Jenkins 2.332.3 and our Jenkins is running on Jenkins 2.263.1 meanwhile and still not working. Tried to reproduce with local Jenkins 2.334 -> working Tried to reproduce with local Jenkins 2.335 -> Not working, as expected (Needed to add/update some dependency versions for doing that in the plugin pom.) Any hints on where to have a closer look now? Will try to determine the changes between Jenkins 2.334 and Jenkins 2.335 now.   Kind regards Jonas  

          Hi Jonas,

          That's extremely helpful! Thanks for trying it out.

          >Any hints on where to have a closer look now?

          Your workflow is pretty similar to what I do. The difference is that I would try:

          1. Eclipse with latest code and using the latest LTS
          2. `java - jar jenkins-old-lts.war`

          Then create a job that works with the old LTS, and that fails in the latest LTS (what you did). Open both in two browsers, side by side, and compare the DOM structure using Firefox and/or Chrome dev tools (F12 on Linux opens it).

          It is very likely something changed in the HTML structure, and we need to update the code to locate the parameters correctly. I used to be able to keep track of these changes and fix the plug-in as they released new versions of Jenkins, but $work and life are keeping me busy now

          Keep us posted if you find anything else. Will try to join and help here once I have some spare time.

          Thanks again!

          Bruno

          Bruno P. Kinoshita added a comment - Hi Jonas, That's extremely helpful! Thanks for trying it out. >Any hints on where to have a closer look now? Your workflow is pretty similar to what I do. The difference is that I would try: Eclipse with latest code and using the latest LTS `java - jar jenkins-old-lts.war` Then create a job that works with the old LTS, and that fails in the latest LTS (what you did). Open both in two browsers, side by side, and compare the DOM structure using Firefox and/or Chrome dev tools (F12 on Linux opens it). It is very likely something changed in the HTML structure, and we need to update the code to locate the parameters correctly. I used to be able to keep track of these changes and fix the plug-in as they released new versions of Jenkins, but $work and life are keeping me busy now Keep us posted if you find anything else. Will try to join and help here once I have some spare time. Thanks again! Bruno

          Krzysztof Mulica added a comment - - edited

          There was a bunch of UI changes if you look at the change log for 2.335 - I would focus on those

          https://www.jenkins.io/changelog/

           https://github.com/jenkinsci/jenkins/pull/5923

          https://github.com/jenkinsci/jenkins/pull/6248

          etc

          Krzysztof Mulica added a comment - - edited There was a bunch of UI changes if you look at the change log for 2.335 - I would focus on those https://www.jenkins.io/changelog/   https://github.com/jenkinsci/jenkins/pull/5923 https://github.com/jenkinsci/jenkins/pull/6248 etc

          Jonas Hommel added a comment - - edited

          I'm still trying to find a cause for that issue ...

          I've found some small change in the parameter form. Please see form_334.JPG for the old version and form_335.JPG for the new version.

          Should this cause the trouble?

          I then tried to find that class names anywhere in the plugin code, but i didn't found it. Neither in Java code, nor in JavaScript Code.

          I'm now on the point, to debug the unochoice.js in firefox, but I'am absolutely new on JavaScript. For now it seems, that the 'this.proxy.doUpdate(parametersString)' in line 609 is called in the older version, but not in the newer.

          Any hints are absolutely welcome

          Jonas Hommel added a comment - - edited I'm still trying to find a cause for that issue ... I've found some small change in the parameter form. Please see form_334.JPG for the old version and form_335.JPG for the new version. Should this cause the trouble? I then tried to find that class names anywhere in the plugin code, but i didn't found it. Neither in Java code, nor in JavaScript Code. I'm now on the point, to debug the unochoice.js in firefox, but I'am absolutely new on JavaScript. For now it seems, that the 'this.proxy.doUpdate(parametersString)' in line 609 is called in the older version, but not in the newer. Any hints are absolutely welcome

          Hi joho ,

          Thanks for trying so hard to find a solution for this issue. Decided to have a quick look before dinner, and I think I managed to locate the issue.

          The fix is here: https://github.com/jenkinsci/active-choices-plugin/pull/61, but the unit tests are broken after the fix I have a few more minutes before I have to give up, so will try to fix the tests, update the changelog and cut a new release. I have also updated dependencies, and replaced a few `==` by `===` (JavaScript).

          Here's how I solved it, if you are interested:

          • I created the configuration to reproduce the problem
          • Then I opened the web developer tools, and saw the log lines, that were not showing the SEND_MAIL param's value
          • I clicked on the "unochoice.js" file to the right of any of the log lines, and set a breakpoint in a function of that file to follow what was going on
          • I edited the DynamicParameter.../index.jelly where it contained JavaScript, I added a breakpoint (simply wrote "debugger") and inspected the values in the browser

          Once I realized that it now had a SPAN instead of DIV, I batch-edited the file to check for both DIV and SPAN (hopefully no side effects of doing it).

          You can have a look at the pull request to see the functions where I put the breakpoints (I'm familiar with the code, so it's more or less a matter of remembering the parts of the code, and some tentative and error).

          Bruno P. Kinoshita added a comment - Hi joho , Thanks for trying so hard to find a solution for this issue. Decided to have a quick look before dinner, and I think I managed to locate the issue. The fix is here: https://github.com/jenkinsci/active-choices-plugin/pull/61, but the unit tests are broken after the fix I have a few more minutes before I have to give up, so will try to fix the tests, update the changelog and cut a new release. I have also updated dependencies, and replaced a few `==` by `===` (JavaScript). Here's how I solved it, if you are interested: I created the configuration to reproduce the problem Then I opened the web developer tools, and saw the log lines, that were not showing the SEND_MAIL param's value I clicked on the "unochoice.js" file to the right of any of the log lines, and set a breakpoint in a function of that file to follow what was going on I edited the DynamicParameter.../index.jelly where it contained JavaScript, I added a breakpoint (simply wrote "debugger") and inspected the values in the browser Once I realized that it now had a SPAN instead of DIV, I batch-edited the file to check for both DIV and SPAN (hopefully no side effects of doing it). You can have a look at the pull request to see the functions where I put the breakpoints (I'm familiar with the code, so it's more or less a matter of remembering the parts of the code, and some tentative and error).

          I wrote the comment above but didn't submit it. I've tried to fix the unit tests… I was going to debug it, but turns out something changed in Jenkins unit tests, or maybe due to my more recent JVM, and now I am not able to debug unit tests... sighs

          Sorry joho . The fix is ready, but this release will have to wait until I have time to deal with these unit tests and with running unit tests with Jenkins.

          A few weeks ago I had a small window for development, and was planning to cut a release, but then the latest release of Jenkins at that time had changed the SpotBugs rules and that blocked my release. Then the UI changes, and the unit tests. Every time I try to work on this plug-in I end up spending a lot longer dealing with Jira (unfortunately I am more accustomed to GH issues these days, so I'm a bit slow with Jira which is also slower than GH), or with Jenkins dependencies/UI/release process, rather than with the actual work.

          If you have time to look at these unit tests, or maybe just test the code in that branch and confirm that it works for you, joho , that'd be grand

          Thanks a lot!

          Bruno

          Bruno P. Kinoshita added a comment - I wrote the comment above but didn't submit it. I've tried to fix the unit tests… I was going to debug it, but turns out something changed in Jenkins unit tests, or maybe due to my more recent JVM, and now I am not able to debug unit tests... sighs Sorry joho . The fix is ready, but this release will have to wait until I have time to deal with these unit tests and with running unit tests with Jenkins. A few weeks ago I had a small window for development, and was planning to cut a release, but then the latest release of Jenkins at that time had changed the SpotBugs rules and that blocked my release. Then the UI changes, and the unit tests. Every time I try to work on this plug-in I end up spending a lot longer dealing with Jira (unfortunately I am more accustomed to GH issues these days, so I'm a bit slow with Jira which is also slower than GH), or with Jenkins dependencies/UI/release process, rather than with the actual work. If you have time to look at these unit tests, or maybe just test the code in that branch and confirm that it works for you, joho , that'd be grand Thanks a lot! Bruno

          Jonas Hommel added a comment - - edited

          Hi kinow ,

           

          i've just spent some time too today and wanted to share my investigation. Then I was really surprised about your comment and that you've found the same thing as I've found

          For documentation purposes, I've still added my snippets (diff_parameter_334.txt diff_parameter_335.txt) for the change in html structure.

          I'll check, try to merge, and understand your change in my local workspace now.

          Many thanks for your support!

          Jonas Hommel added a comment - - edited Hi kinow ,   i've just spent some time too today and wanted to share my investigation. Then I was really surprised about your comment and that you've found the same thing as I've found For documentation purposes, I've still added my snippets ( diff_parameter_334.txt diff_parameter_335.txt ) for the change in html structure. I'll check, try to merge, and understand your change in my local workspace now. Many thanks for your support!

          Jonas Hommel added a comment -

          Fix is working as expected in local workspace. But i've got issues with the unit tests too.

          Jonas Hommel added a comment - Fix is working as expected in local workspace. But i've got issues with the unit tests too.

          Released in 2.6.2. Remember to back up before installing, and/or using a test instance.

          Bruno P. Kinoshita added a comment - Released in 2.6.2. Remember to back up before installing, and/or using a test instance.

          Jonas Hommel added a comment -

          Thanks a lot kinow . I will try to install the update within our next update session.

          Jonas Hommel added a comment - Thanks a lot kinow . I will try to install the update within our next update session.

          Jeremy Cooper added a comment - - edited

          I tried this out with version 2.350  and it appears that the problem still persists.   I will do some more debugging to see if i can come up with anymore information.  Looks like this works for parameters of type "Active Choices Reactive Reference Parameter" but fails for "Active Choices Reactive Parameter"

          Jeremy Cooper added a comment - - edited I tried this out with version 2.350  and it appears that the problem still persists.   I will do some more debugging to see if i can come up with anymore information.  Looks like this works for parameters of type "Active Choices Reactive Reference Parameter" but fails for "Active Choices Reactive Parameter"

          Jeremy Cooper added a comment -

          Looks like /active-choices-plugin-uno-choice/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly

          needs this at line 56:

          else if (child.tagName == 'DIV' || child.tagName == 'SPAN')

          Jeremy Cooper added a comment - Looks like /active-choices-plugin-uno-choice/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly needs this at line 56: else if (child.tagName == 'DIV' || child.tagName == 'SPAN' )

          Sebastian added a comment - - edited

          Hi everybody,

          I tested the fix from jeremy_jenkins successfully and created a pull request for it: https://github.com/jenkinsci/active-choices-plugin/pull/62

          I hope it makes it into the next version

          Sebastian added a comment - - edited Hi everybody, I tested the fix from jeremy_jenkins successfully and created a pull request for it: https://github.com/jenkinsci/active-choices-plugin/pull/62 I hope it makes it into the next version

          Pull request merged and released. 2.6.3 should be available in the update center in the next hours. Thanks!

          Bruno P. Kinoshita added a comment - Pull request merged and released. 2.6.3 should be available in the update center in the next hours. Thanks!

          This and https://issues.jenkins.io/browse/JENKINS-68012 look to be fixed now, thank you!

          Krzysztof Mulica added a comment - This and https://issues.jenkins.io/browse/JENKINS-68012 look to be fixed now, thank you!

            kinow Bruno P. Kinoshita
            jeremy_jenkins Jeremy Cooper
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: