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

Problem with Active Choices 1.0 and jQuery

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Component/s: active-choices-plugin
    • Labels:
      None
    • Environment:
      Java 1.8.0_31
      Clean installation of Jenkins 1.617;
      Additional plugins:
       - Active Choices 1.0
       - Validating String Parameter 2.3
       - jQuery 1.11.2-0
    • Similar Issues:

      Description

      In short: I tried to migrate an existing project from Uno Choice 0.19 to Active Choice 1.0 and I found that I can not reach the referred parameter. I tried various methods to get the value of the referred parameter with no success. I tried to reproduce the problem on a clean Jenkins copy and everything worked like a charm. What was going on, then?!

      Here you are the details:
      1. I installed a fresh copy of Jenkins - I took jenkins.war version 1.617 and started it with
      java -jar jenkins.war
      2. Entered the management console and:

      Here is the list of the installed plugins with their versions:

       Active Choices Plug-in              | 1.0
       Ant Plugin                          | 1.2
       Credentials Plugin                  | 1.22
       CVS Plug-in                         | 2.12
       External Monitor Job Type Plugin    | 1.4
       GIT client plugin                   | 1.17.1
       GIT plugin                          | 2.3.5
       Git server plugin                   | 1.6
       Javadoc Plugin                      | 1.3
       JUnit Plugin                        | 1.6
       LDAP Plugin                         | 1.11
       Mailer Plugin                       | 1.15
       MapDB API Plugin                    | 1.0.6.0
       Matrix Authorization Strategy Plugin| 1.2
       Matrix Project Plugin               | 1.6
       Maven Integration plugin            | 2.10
       OWASP Markup Formatter Plugin       | 1.3
       PAM Authentication plugin           | 1.2
       SCM API Plugin                      | 0.2
       Script Security Plugin              | 1.14
       Scriptler                           | 2.7
       SSH Credentials Plugin              | 1.11
       SSH Slaves plugin                   | 1.9
       Subversion Plug-in                  | 2.5
       Token Macro Plugin                  | 1.10
       Translation Assistance plugin       | 1.12
       Validating String Parameter Plugin  | 2.3
       Windows Slaves Plugin               | 1.1
      

      3. Created a simple test project (attached). You can see that its only purpose is to get the value of the Validating String parameter using different paths;

      4. Opened the test project and hit "Build with Parameters"

      The observations on the script running:
      A. There is always one error thrown on the page load:

      Jun 23, 2015 4:57:02 PM FINEST org.biouno.unochoice.model.GroovyScript
      
      Fallback to default script...
      groovy.lang.MissingPropertyException: No such property: validStr for class: Script1
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
          at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
          at Script1.run(Script1.groovy:2)
          at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
          at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
          at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
          at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:128)
          at org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:69)
          at org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:138)
          at org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:104)
          at org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:93)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:483)
          at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
          at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
          at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
          at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
          at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
          at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
          at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:74)
              ...
      

      B. Immediately after that the (valid) script output is observed in the console:

         ---------------------------------------------
         ---> validStr=
         ---> validStr=
         ---> binding.variables.get =
         ---> binding = groovy.lang.Binding@2d47c5ae
         ---> binding.variables = [validStr:]
         ---> binding.getProperty =
         ---> getBinding = groovy.lang.Binding@2d47c5ae
         ---> getProperty =
      

      C. Entering a value in the Validating String parameter, on the exit (lost focus) of the text field, the correct value is observed in the Active Choices parameter:

         ---------------------------------------------
         ---> validStr= 123
         ---> validStr= 123
         ---> binding.variables.get = 123
         ---> binding = groovy.lang.Binding@2c331bee
         ---> binding.variables = [validStr:123]
         ---> binding.getProperty = 123
         ---> getBinding = groovy.lang.Binding@2c331bee
         ---> getProperty = 123
      

      So far - so good

      5. (In short) Installed jQuery Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin ) and restarted Jenkins. The newly installed plugin is
      {{ jQuery plugin | 1.11.2-0}}

      6. Opened the test project and hit "Build with Parameters"

      The observations on the script running:
      A. The "No such property" exception is still there;

      B. Immediately after that the (valid) script output is observed in the console:

         ---------------------------------------------
         ---> validStr=
         ---> validStr=
         ---> binding.variables.get =
         ---> binding = groovy.lang.Binding@2d47c5ae
         ---> binding.variables = [validStr:]
         ---> binding.getProperty =
         ---> getBinding = groovy.lang.Binding@2d47c5ae
         ---> getProperty =
      

      C. Entering a value in the Validating String parameter, on the exit (lost focus) of the text field, the NO value is observed in the Active Choices parameter:

         ---------------------------------------------
         ---> validStr=
         ---> validStr=
         ---> binding.variables.get =
         ---> binding = groovy.lang.Binding@1af9ece6
         ---> binding.variables = [validStr:]
         ---> binding.getProperty =
         ---> getBinding = groovy.lang.Binding@1af9ece6
         ---> getProperty =
      

      7. Edited the test project and gave the Validating String parameter a default value - "234". Saved the new definition and hit "Build with Parameters"
      The observations on the script running:
      A. The "No such property" exception is still there;

      B. Immediately after that the (valid) script output is observed in the console - the default value is displayed:

         ---------------------------------------------
         ---> validStr= 234
         ---> validStr= 234
         ---> binding.variables.get = 234
         ---> binding = groovy.lang.Binding@4ae9665a
         ---> binding.variables = [validStr:234]
         ---> binding.getProperty = 234
         ---> getBinding = groovy.lang.Binding@4ae9665a
         ---> getProperty = 234
      

      C. Entering a different value ("123" in the Validating String parameter, on the exit (lost focus) of the text field, the default value is observed in the Active Choices parameter:

         ---------------------------------------------
         ---> validStr= 234
         ---> validStr= 234
         ---> binding.variables.get = 234
         ---> binding = groovy.lang.Binding@77a897d5
         ---> binding.variables = [validStr:234]
         ---> binding.getProperty = 234
         ---> getBinding = groovy.lang.Binding@77a897d5
         ---> getProperty = 234
      

      9. Removed the jQuery plugin, restarted Jenkins and the correct behavior of Active Choices parameter came back.

      Notes:

      • during all experiments there are no other errors registered in Jenkins logs except the "No such property" one;
      • the existing project (the one that uses Uno Choice 0.19) works fine with the mentioned jQuery version 1.11.2-0

      To be honest, I repeated the above scenario (from the Jenkins installation) several times due to different technical reasons and the result was always the same - jQuery interferes with Active Choices Plugin

        Attachments

          Activity

          Hide
          kinow Bruno P. Kinoshita added a comment -

          Hi, I spent some time today tried to reproduce, but it is working correctly for me in development (Eclipse + Maven) and also in an existing installation that was upgraded from Uno Choice 0.23 to Active Choices 1.0. I'm closing as I cannot reproduce, but users facing the same problem will be able to find this issue and follow your work flow to see if they can fix their installations.

          Thanks a lot for reporting and for the detailed issue description

          Bruno

          Show
          kinow Bruno P. Kinoshita added a comment - Hi, I spent some time today tried to reproduce, but it is working correctly for me in development (Eclipse + Maven) and also in an existing installation that was upgraded from Uno Choice 0.23 to Active Choices 1.0. I'm closing as I cannot reproduce, but users facing the same problem will be able to find this issue and follow your work flow to see if they can fix their installations. Thanks a lot for reporting and for the detailed issue description Bruno
          Hide
          mmaker1234 Monique Maker added a comment -

          Hello Bruno,

          The problems upgrading our existing environment were only the reason I to start the investigation. My description of the problem refers a clean installation, not an upgrade. In addition (that was not mentioned) our existing environment is on Linux, and I tested on Windows, i.e. I made as much as possible to separate the test environment to ensure there are no hidden relations or dependencies.

          Best Regards,
          Vladimir

          Show
          mmaker1234 Monique Maker added a comment - Hello Bruno, The problems upgrading our existing environment were only the reason I to start the investigation. My description of the problem refers a clean installation, not an upgrade. In addition (that was not mentioned) our existing environment is on Linux, and I tested on Windows, i.e. I made as much as possible to separate the test environment to ensure there are no hidden relations or dependencies. Best Regards, Vladimir
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Hmmm, let me re-read the issue and try with 1.617

          Show
          kinow Bruno P. Kinoshita added a comment - Hmmm, let me re-read the issue and try with 1.617
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/java/org/biouno/unochoice/model/ScriptlerScript.java
          http://jenkins-ci.org/commit/active-choices-plugin/878f509d564a48671af629156ba4074ee0dd6fd8
          Log:
          [FIXED JENKINS-29055] Change logic to add parameters to the binding context of the Scriptler script. Then expand parameters used in the script too.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/java/org/biouno/unochoice/model/ScriptlerScript.java http://jenkins-ci.org/commit/active-choices-plugin/878f509d564a48671af629156ba4074ee0dd6fd8 Log: [FIXED JENKINS-29055] Change logic to add parameters to the binding context of the Scriptler script. Then expand parameters used in the script too.
          Hide
          kinow Bruno P. Kinoshita added a comment -
          • Installed Jenkins 1.617 (Oracle JDK 1.7)
          • Dismissed security message
          • Updated all plug-ins
          • Installed Validating String Plug-in
          • Installed Active Choices Plug-in 1.0
          • Restarted Jenkins
          • Created a dummy job
          • Replaced its config.xml by the attached one
          • Reloaded configuration from disk
          • Went to build with parameters screen
             ---------------------------------------------
           ---> Err
          
             ---------------------------------------------
             ---> validStr= 234
             ---> validStr= 234
             ---> binding.variables.get = 234
             ---> binding = groovy.lang.Binding@f45d3
             ---> binding.variables = [validStr:234]
             ---> binding.getProperty = 234
             ---> getBinding = groovy.lang.Binding@f45d3
             ---> getProperty = 234
          

          No other errors in the console output, and the values seem to have been updated correctly. Changing the value of the parameter and clicking outside to trigger the update results in

             ---> getProperty = 234
          Jun 28, 2015 8:49:56 PM javax.jmdns.impl.DNSIncoming readAnswer
          WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data: 9AF8B273995DB15E
          
             ---------------------------------------------
             ---> validStr= 234sa
             ---> validStr= 234sa
             ---> binding.variables.get = 234sa
             ---> binding = groovy.lang.Binding@e316e1
             ---> binding.variables = [validStr:234sa]
             ---> binding.getProperty = 234sa
             ---> getBinding = groovy.lang.Binding@e316e1
             ---> getProperty = 234sa
          

          Changing the script from `return []` to `return [validStr]` shows the value as a radio button, as expected. And

             ---------------------------------------------
             ---> validStr= 234dd
             ---> validStr= 234dd
             ---> binding.variables.get = 234dd
             ---> binding = groovy.lang.Binding@3a811c
             ---> binding.variables = [validStr:234dd]
             ---> binding.getProperty = 234dd
             ---> getBinding = groovy.lang.Binding@3a811c
             ---> getProperty = 234dd
          

          List of plug-ins installed:

          windows-slaves    ->    1.1
          validating-string-parameter    ->    2.3
          uno-choice    ->    1.0
          translation    ->    1.12
          token-macro    ->    1.10
          subversion    ->    2.5
          ssh-slaves    ->    1.9
          ssh-credentials    ->    1.11
          scriptler    ->    2.7
          script-security    ->    1.14
          scm-api    ->    0.2
          pam-auth    ->    1.2
          maven-plugin    ->    2.10
          matrix-project    ->    1.6
          matrix-auth    ->    1.2
          mapdb-api    ->    1.0.6.0
          mailer    ->    1.15
          ldap    ->    1.11
          junit    ->    1.6
          javadoc    ->    1.3
          git-server    ->    1.6
          git-client    ->    1.17.1
          git    ->    2.3.5
          external-monitor-job    ->    1.4
          cvs    ->    2.12
          credentials    ->    1.22
          antisamy-markup-formatter    ->    1.3
          ant    ->    1.2
          

          Updated the job and removed the default value (234). Tried to build it again, empty cascade parameter, and

             ---> validStr= 
             ---> validStr= 
             ---> binding.variables.get = 
             ---> binding = groovy.lang.Binding@5ee469
             ---> binding.variables = [validStr:]
             ---> binding.getProperty = 
             ---> getBinding = groovy.lang.Binding@5ee469
             ---> getProperty = 
          

          Typed 123

             ---> validStr= 123
             ---> validStr= 123
             ---> binding.variables.get = 123
             ---> binding = groovy.lang.Binding@1ec03a6
             ---> binding.variables = [validStr:123]
             ---> binding.getProperty = 123
             ---> getBinding = groovy.lang.Binding@1ec03a6
             ---> getProperty = 123
          

          My environment:

          Linux chuva 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
          Ubuntu 14.04.01
          
          java version "1.7.0_79"
          Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
          Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode)
          
          Jenkins 1.617
          

          I didn't install the JQuery plug-in. The plug-in by default injects a jquery version (see https://github.com/jenkinsci/active-choices-plugin/blob/d57ac661e202258343739af270d383288cf85e96/pom.xml#L59 and https://github.com/jenkinsci/active-choices-plugin/blob/d57ac661e202258343739af270d383288cf85e96/src/main/resources/org/biouno/unochoice/common/choiceParameterCommon.jelly#L4).

          Show
          kinow Bruno P. Kinoshita added a comment - Installed Jenkins 1.617 (Oracle JDK 1.7) Dismissed security message Updated all plug-ins Installed Validating String Plug-in Installed Active Choices Plug-in 1.0 Restarted Jenkins Created a dummy job Replaced its config.xml by the attached one Reloaded configuration from disk Went to build with parameters screen --------------------------------------------- ---> Err --------------------------------------------- ---> validStr= 234 ---> validStr= 234 ---> binding.variables.get = 234 ---> binding = groovy.lang.Binding@f45d3 ---> binding.variables = [validStr:234] ---> binding.getProperty = 234 ---> getBinding = groovy.lang.Binding@f45d3 ---> getProperty = 234 No other errors in the console output, and the values seem to have been updated correctly. Changing the value of the parameter and clicking outside to trigger the update results in ---> getProperty = 234 Jun 28, 2015 8:49:56 PM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data: 9AF8B273995DB15E --------------------------------------------- ---> validStr= 234sa ---> validStr= 234sa ---> binding.variables.get = 234sa ---> binding = groovy.lang.Binding@e316e1 ---> binding.variables = [validStr:234sa] ---> binding.getProperty = 234sa ---> getBinding = groovy.lang.Binding@e316e1 ---> getProperty = 234sa Changing the script from `return []` to `return [validStr] ` shows the value as a radio button, as expected. And --------------------------------------------- ---> validStr= 234dd ---> validStr= 234dd ---> binding.variables.get = 234dd ---> binding = groovy.lang.Binding@3a811c ---> binding.variables = [validStr:234dd] ---> binding.getProperty = 234dd ---> getBinding = groovy.lang.Binding@3a811c ---> getProperty = 234dd List of plug-ins installed: windows-slaves -> 1.1 validating-string-parameter -> 2.3 uno-choice -> 1.0 translation -> 1.12 token-macro -> 1.10 subversion -> 2.5 ssh-slaves -> 1.9 ssh-credentials -> 1.11 scriptler -> 2.7 script-security -> 1.14 scm-api -> 0.2 pam-auth -> 1.2 maven-plugin -> 2.10 matrix-project -> 1.6 matrix-auth -> 1.2 mapdb-api -> 1.0.6.0 mailer -> 1.15 ldap -> 1.11 junit -> 1.6 javadoc -> 1.3 git-server -> 1.6 git-client -> 1.17.1 git -> 2.3.5 external-monitor-job -> 1.4 cvs -> 2.12 credentials -> 1.22 antisamy-markup-formatter -> 1.3 ant -> 1.2 Updated the job and removed the default value (234). Tried to build it again, empty cascade parameter, and ---> validStr= ---> validStr= ---> binding.variables.get = ---> binding = groovy.lang.Binding@5ee469 ---> binding.variables = [validStr:] ---> binding.getProperty = ---> getBinding = groovy.lang.Binding@5ee469 ---> getProperty = Typed 123 ---> validStr= 123 ---> validStr= 123 ---> binding.variables.get = 123 ---> binding = groovy.lang.Binding@1ec03a6 ---> binding.variables = [validStr:123] ---> binding.getProperty = 123 ---> getBinding = groovy.lang.Binding@1ec03a6 ---> getProperty = 123 My environment: Linux chuva 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 14.04.01 java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode) Jenkins 1.617 I didn't install the JQuery plug-in. The plug-in by default injects a jquery version (see https://github.com/jenkinsci/active-choices-plugin/blob/d57ac661e202258343739af270d383288cf85e96/pom.xml#L59 and https://github.com/jenkinsci/active-choices-plugin/blob/d57ac661e202258343739af270d383288cf85e96/src/main/resources/org/biouno/unochoice/common/choiceParameterCommon.jelly#L4 ).
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Committed using this issue as commit message, so please ignore the commit message set by SCM/JIRA link daemon.

          Show
          kinow Bruno P. Kinoshita added a comment - Committed using this issue as commit message, so please ignore the commit message set by SCM/JIRA link daemon.
          Hide
          mmaker1234 Monique Maker added a comment -

          Thank you, Bruno!
          Active Choices 1.1. works fine.

          Cheers,
          Vladimir

          Show
          mmaker1234 Monique Maker added a comment - Thank you, Bruno! Active Choices 1.1. works fine. Cheers, Vladimir

            People

            Assignee:
            kinow Bruno P. Kinoshita
            Reporter:
            mmaker1234 Monique Maker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: