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

Active choice reactive reference parameter not working on checkbox reference

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Jenkins 2.6 (win), Active choices 1.4, Chrome 51

      When I create an active choices reactive reference like the wine example but using a checkbox parameter instead an single value selection it won't get updated on changing the checkboxes. If I modify the choice type of the reference parameter to single select it works.

        1. config[1].xml
          10 kB
        2. example.jpg
          example.jpg
          2 kB
        3. GIFrecord_2016-10-26_132739.gif
          GIFrecord_2016-10-26_132739.gif
          144 kB
        4. GIFrecord_2016-10-26_134846.gif
          GIFrecord_2016-10-26_134846.gif
          97 kB
        5. image-2017-03-30-12-27-15-823.png
          image-2017-03-30-12-27-15-823.png
          24 kB
        6. image-2017-03-30-12-27-53-554.png
          image-2017-03-30-12-27-53-554.png
          24 kB
        7. jenkins2016103101.png
          jenkins2016103101.png
          314 kB
        8. jquery.png
          jquery.png
          45 kB
        9. screenshot-1.png
          screenshot-1.png
          19 kB
        10. Screenshot from 2016-10-26 13-46-44.png
          Screenshot from 2016-10-26 13-46-44.png
          67 kB
        11. Screenshot from 2016-10-26 13-46-58.png
          Screenshot from 2016-10-26 13-46-58.png
          56 kB
        12. setup.jpg
          setup.jpg
          106 kB
        13. uno-choice-0.15-20161026.hpi
          1.73 MB
        14. uno-choice-20161029.hpi
          1.74 MB

          [JENKINS-36158] Active choice reactive reference parameter not working on checkbox reference

          Matthias Zangl added a comment - - edited

          Good news, I think I found the responsible plugin which causes the conflict.

          Its the jquery plugin which comes with the pipeline delivery plugin. The active choice stops working when I install the jquery plugin and its working again when I uninstall it.

          Matthias Zangl added a comment - - edited Good news, I think I found the responsible plugin which causes the conflict. Its the jquery plugin which comes with the pipeline delivery plugin. The active choice stops working when I install the jquery plugin and its working again when I uninstall it.

          That's great news Matthias. Kudos for the investigate work

          And it is also interesting that the jquery plugin seems to be the issue.

          Jenkins plug-in developers use "adjuncts", which are a resource that imports an asset only once. So if two plug-ins need JQuery, what is important is that they are both using adjuncts.

          The Delivery Pipeline plug-in seems to be using adjuncts

          https://github.com/Diabol/delivery-pipeline-plugin/blob/master/src/main/resources/se/diabol/jenkins/pipeline/DeliveryPipelineView/index.jelly#L31

          As well as Active Choices

          https://github.com/jenkinsci/active-choices-plugin/blob/2daaa86bb4a2e6a882fdb9cc1b846371eba497f5/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly#L5

          But the JQuery adjunct version used in both is different. We are a few versions behind.

          I just attached a new HPI file (see timestamp). If you have time, could you try this one, with and without the delivery pipeline plugin, please?

          Cheers
          B

          Bruno P. Kinoshita added a comment - That's great news Matthias. Kudos for the investigate work And it is also interesting that the jquery plugin seems to be the issue. Jenkins plug-in developers use "adjuncts", which are a resource that imports an asset only once. So if two plug-ins need JQuery, what is important is that they are both using adjuncts. The Delivery Pipeline plug-in seems to be using adjuncts https://github.com/Diabol/delivery-pipeline-plugin/blob/master/src/main/resources/se/diabol/jenkins/pipeline/DeliveryPipelineView/index.jelly#L31 As well as Active Choices https://github.com/jenkinsci/active-choices-plugin/blob/2daaa86bb4a2e6a882fdb9cc1b846371eba497f5/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly#L5 But the JQuery adjunct version used in both is different. We are a few versions behind. I just attached a new HPI file (see timestamp). If you have time, could you try this one, with and without the delivery pipeline plugin, please? Cheers B

          Matthias Zangl added a comment - - edited

          Hi, thanks for the provided hpi. I tested it.

          But the new one does not work with nor without the Delivery Pipeline Plugin. On checkbox button click it fires but the OPTION_C is not updated.

          I attached the screenshot

          thanks,
          Matthias

          Matthias Zangl added a comment - - edited Hi, thanks for the provided hpi. I tested it. But the new one does not work with nor without the Delivery Pipeline Plugin. On checkbox button click it fires but the OPTION_C is not updated. I attached the screenshot thanks, Matthias

          Hi Matthias,

          I suspect the Delivery Pipeline Plugin is not really causing this issue.

          I started the plugin in debug again in Eclipse. Re-created the job using the same script from my previous commits. Installed the Delivery Pipeline plug-in. Restarted Jenkins. Configured the job to include the Delivery Plugin configuration, with some dummy values.

          Everything works fine.

          Your Jenkins looks a bit different, and I have never seen theme.js appear in any of my previous errors with JavaScript in Jenkins. Are you sure you don't have another plug-in causing this issue? You may have to do some investigate work, starting always by a blank vanilla Jenkins + active choices, and then slowly adding your other plug-in/dependency/script/etc.

          I'll have to work on other issues in this development cycle, and likely won't have time to debug this issue again, unless there is a definite way to reproduce it in my environment (or if there is a pull request ). Will start another development cycle near December anyway, so we can fix it before x-mas and cut a release.

          Bruno P. Kinoshita added a comment - Hi Matthias, I suspect the Delivery Pipeline Plugin is not really causing this issue. I started the plugin in debug again in Eclipse. Re-created the job using the same script from my previous commits. Installed the Delivery Pipeline plug-in. Restarted Jenkins. Configured the job to include the Delivery Plugin configuration, with some dummy values. Everything works fine. Your Jenkins looks a bit different, and I have never seen theme.js appear in any of my previous errors with JavaScript in Jenkins. Are you sure you don't have another plug-in causing this issue? You may have to do some investigate work, starting always by a blank vanilla Jenkins + active choices, and then slowly adding your other plug-in/dependency/script/etc. I'll have to work on other issues in this development cycle, and likely won't have time to debug this issue again, unless there is a definite way to reproduce it in my environment (or if there is a pull request ). Will start another development cycle near December anyway, so we can fix it before x-mas and cut a release.

          Hi Bruno,

          sure, I understand. On my first try to reproduce in my test environment I built it too be similiar as my production server. The theme.js may come from a theming plugin I installed.

          I'll start from scratch and see if I can track it down to the JQuery plugin again.

          I keep you informed

          best regards,
          Matthias

          Matthias Zangl added a comment - Hi Bruno, sure, I understand. On my first try to reproduce in my test environment I built it too be similiar as my production server. The theme.js may come from a theming plugin I installed. I'll start from scratch and see if I can track it down to the JQuery plugin again. I keep you informed best regards, Matthias

          Hi Bruno,

          ok, started from scratch. I installed the jenkins 2.19.1 using the suggest plugins during installation. After that I installed active choices plugin and built my demo project. As expected it worked. Then I only installed jQuery plugin + restarted jenkins service and the sample stopped working. Disabling the jQuery plugin and restart jenkins service it works again.

          At this point I started from scratch again. This time I didn't install any plugins during jenkins installation routine. After installation I just added active choices plugin (including the plugins it obviously depends on), restarted and my example project worked. Then I just installed jquery (and its depending plugins) , restarted and it didn't work anymore.

          The host in this sandbox environment was a windows 7 32 bit.

          Hope this helps you to reproduce it on your side.

          best regards,
          Matthias

          Matthias Zangl added a comment - Hi Bruno, ok, started from scratch. I installed the jenkins 2.19.1 using the suggest plugins during installation. After that I installed active choices plugin and built my demo project. As expected it worked. Then I only installed jQuery plugin + restarted jenkins service and the sample stopped working. Disabling the jQuery plugin and restart jenkins service it works again. At this point I started from scratch again. This time I didn't install any plugins during jenkins installation routine. After installation I just added active choices plugin (including the plugins it obviously depends on), restarted and my example project worked. Then I just installed jquery (and its depending plugins) , restarted and it didn't work anymore. The host in this sandbox environment was a windows 7 32 bit. Hope this helps you to reproduce it on your side. best regards, Matthias

          mattsbg thank you for your investigation. I finally can reproduce this bug and I can confirm that is related not only to the jQuery plugin, but also a particular version of the plugin. Active Choice Reactive references are working as expected with jQuery plugin 1.7.2-1 but not with the latest version 1.11.2-0.

          Hopefully kinow will be able to focus on this particular finding to resolve the bug. Thank you both!!

           

          kinow attached is an example to try.

          With multi-select you get this

           

          With Check Boxes you get

          Note that the checkbox values are not propagated to AC_REFPRAM_C but interestingly, they are propagated to the build!

          config[1].xml

          Ioannis Moutsatsos added a comment - mattsbg thank you for your investigation. I finally can reproduce this bug and I can confirm that is related not only to the jQuery plugin, but also a particular version of the plugin. Active Choice Reactive references are working as expected with jQuery plugin 1.7.2-1 but not with the latest version 1.11.2-0. Hopefully kinow will be able to focus on this particular finding to resolve the bug. Thank you both!!   kinow attached is an example to try. With multi-select you get this   With Check Boxes you get Note that the checkbox values are not propagated to AC_REFPRAM_C but interestingly, they are propagated to the build! config[1].xml

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          pom.xml
          src/test/js/lib/jquery-1.11.2.min.js
          src/test/js/lib/jquery-1.7.2.min.js
          src/test/js/lib/qunit-1.14.0.css
          src/test/js/lib/qunit-1.14.0.js
          src/test/js/lib/tests.html
          http://jenkins-ci.org/commit/active-choices-plugin/8a97011b547cde9520929a1370e38c0b3a4972ef
          Log:
          JENKINS-36158: update JQuery to 1.11.2 to match stapler-jquery-adjunct's version

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: pom.xml src/test/js/lib/jquery-1.11.2.min.js src/test/js/lib/jquery-1.7.2.min.js src/test/js/lib/qunit-1.14.0.css src/test/js/lib/qunit-1.14.0.js src/test/js/lib/tests.html http://jenkins-ci.org/commit/active-choices-plugin/8a97011b547cde9520929a1370e38c0b3a4972ef Log: JENKINS-36158 : update JQuery to 1.11.2 to match stapler-jquery-adjunct's version

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js
          http://jenkins-ci.org/commit/active-choices-plugin/a5f051216707b73f214748bf1717ec9e98acea55
          Log:
          [FIXED JENKINS-36158] use .prop instead of .attr, and treat it as bool

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js http://jenkins-ci.org/commit/active-choices-plugin/a5f051216707b73f214748bf1717ec9e98acea55 Log: [FIXED JENKINS-36158] use .prop instead of .attr, and treat it as bool

          Previous change was to upgrade JQuery. Then started debugging this issue after a message on the biouno-developers mailing list.

          Debugging, could find that a e.attr('checked') was returning undefined, though it was supposed to return something... searching I found some people with similar problem. Looks like e.attr() was replaced by e.prop(), and now it returns boolean.

          http://forum.jquery.com/topic/please-explain-attr-vs-prop-change-in-1-6
          https://stackoverflow.com/questions/5270689/attrchecked-checked-does-not-work/15385392

          Fixed, included in the next release. Thanks!
          Bruno

          Bruno P. Kinoshita added a comment - Previous change was to upgrade JQuery. Then started debugging this issue after a message on the biouno-developers mailing list. Debugging, could find that a e.attr('checked') was returning undefined, though it was supposed to return something... searching I found some people with similar problem. Looks like e.attr() was replaced by e.prop(), and now it returns boolean. http://forum.jquery.com/topic/please-explain-attr-vs-prop-change-in-1-6 https://stackoverflow.com/questions/5270689/attrchecked-checked-does-not-work/15385392 Fixed, included in the next release. Thanks! Bruno

            kinow Bruno P. Kinoshita
            mattsbg Matthias Zangl
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: