I am using Groovy to try to update an existing build parameter. I based my work on this example <https://groups.google.com/forum/#%21topic/jenkinsci-users/szhuDfCvpiE> from this list. However, I am getting an error saying my argument types are incorrect. Here's my code and the output from running it as a system Groovy script build step in Jenkins 1.509.4 on Win 7, with parameter INSTALL_HOME defined in the job with no default:

import hudson.model.*

def npl = new ArrayList<StringParameterValue>();
npl.add(new StringParameterValue("INSTALL_HOME", "/home/test/install/my_install"));

def newPa = null;
def oldPa = build.getAction(ParametersAction.class);
if (oldPa != null) {
  build.actions.remove(oldPa);
  newPa = oldPa.createUpdated(npl);
} else {
  newPa = new ParametersAction(npl);
}
build.actions.add(newPa);

======= output ===========================

Started by useranonymous  <http://localhost:8080/user/null>
Building in workspace C:\Users\ericp\.hudson\jobs\eric_test3\workspace
FATAL: No signature of method: hudson.model.ParametersAction.createUpdated() is 
applicable for argument types: (java.util.ArrayList) values: 
[[(StringParameterValue) INSTALL_HOME='/home/test/install/my_install']]
groovy.lang.MissingMethodException  
<http://stacktrace.jenkins-ci.org/search?query=groovy.lang.MissingMethodException>:
 No signature of method: hudson.model.ParametersAction.createUpdated() is applicable 
for argument types: (java.util.ArrayList) values: [[(StringParameterValue) 
INSTALL_HOME='/home/test/install/my_install']]
        
atorg.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) 
 
<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap&entity=method>
        
atorg.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)  
<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call&entity=method>
        
atorg.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)  
<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall&entity=method>


This does not make sense. It says right in the error message that I'm calling createUpdated with argument of type ArrayList, containing values of type StringParameterValue, and the declaration of method createUpdated is:

public ParametersAction createUpdated(Collection<? extends ParameterValue> 
overrides)

Any idea what's going on?

Thanks,
Eric

--
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 jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to