Forwarding to the users list, regarding not being able to find a parameter, and
no error messages. I'm trying to start a development cycle to work on the
plug-in (and probably on nunit, tap, etc, too).
But if anyone else have similar problems, Vladimir is filing an issue in JIRA,
feel free to chime in and comment with your settings and I'll take a look as
soon as possible. If you have similar problems, maybe following Vladimir's
instructions may work for you too.
Thank you
Bruno
----- Forwarded Message -----
From: Vladimir Krumov <[email protected]>
To: [email protected]
Sent: Wednesday, June 24, 2015 6:36 PM
Subject: Fwd: Problem with Active Choices 1.0 and jQuery
Hello Bruno,
In short: I tried to migrate our 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:
- Dismissed the "Unsecured Jenkins" warning;
- Updated all plugins;
- installed Validating String Parameter Plugin (
https://wiki.jenkins-ci.org/display/JENKINS/Validating+String+Parameter+Plugin
) because our original project uses it (and, to be honest, because in the
beginning I thought that it is the one that is not compatible with Active
Choices plugin);
- Installed Active Choices Plugin version 1.0 (
https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin );
- Setup a new Jenkins logger according to
https://wiki.jenkins-ci.org/display/JENKINS/Troubleshooting
- restarted Jenkins;
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 projects' parameters 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
atorg.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
atorg.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
atorg.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)
atorg.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:138)
atorg.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:104)
atorg.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
atorg.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
atorg.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
atorg.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
athudson.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. :-)
Note that during all experiments there are no other errors registered in
Jenkins logs except the "No such property" one.
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 :-(
I hope this could help for the Active Choices plugin improvement.
Cheers,
Vladimir Krumov
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/1582241817.61416.1435132757940.JavaMail.yahoo%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.plugins.validating__string__parameter.ValidatingStringParameterDefinition plugin="[email protected]">
<name>validStr</name>
<description></description>
<defaultValue>234</defaultValue>
<regex>.*</regex>
<failedValidationMessage></failedValidationMessage>
</hudson.plugins.validating__string__parameter.ValidatingStringParameterDefinition>
<org.biouno.unochoice.CascadeChoiceParameter plugin="[email protected]">
<name>choiceParam</name>
<description></description>
<randomName>choice-parameter-1029743258514277</randomName>
<script class="org.biouno.unochoice.model.GroovyScript">
<script>println("\n ---------------------------------------------" );
println(" ---> validStr= " + validStr); //Provided by Active Choices plugin
println(" ---> validStr= ${validStr}" ); //Provided by Active Choices plugin - try a different reference
println(" ---> binding.variables.get = " + binding.variables.get("validStr") ); //Get from the script environment variables
println(" ---> binding = " + binding ); //Check if available
println(" ---> binding.variables = " + binding.variables ); //Check what is available in the script environment variables
println(" ---> binding.getProperty = " + binding.getProperty("validStr") ); //Get from the script environment properties
//println(" ---> build = " + build ); //Check if available - Throws an exception
//println(" ---> build.buildVariableResolver = " + build.buildVariableResolver );
//println(" ---> build.buildVariableResolver.resolve = " + build.buildVariableResolver.resolve("validStr") );
//println this.getClass().metaClass.methods*.name.sort().unique(); //Check the available methods
println(" ---> getBinding = " + getBinding() ); //Check if available
//println getBinding().getClass().metaClass.methods*.name.sort().unique(); //Check the available methods
println(" ---> getProperty = " + getProperty("validStr") ); //Get from the script environment properties
return [];</script>
<fallbackScript>println( " ---> Err" );
return [];</fallbackScript>
</script>
<visibleItemCount>1</visibleItemCount>
<parameters class="linked-hash-map"/>
<referencedParameters>validStr</referencedParameters>
<choiceType>PT_RADIO</choiceType>
<filterable>false</filterable>
</org.biouno.unochoice.CascadeChoiceParameter>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>