Using jenkins-cli.jar groovy . . . is there some cleaver way to pass parameters into the Groovy script?

575 views
Skip to first unread message

Merrow, Frank

unread,
Mar 22, 2013, 4:33:04 PM3/22/13
to jenkins...@googlegroups.com

So I am using Jenkins-cli to execute a groovy script in my Jenkins servers . . . works great.

 

Except now I want to pass that groovy script a parameter . . .

 

Does someone have some cleaver way of passing data into the Groovy script?

 

Frank

niristotle okram

unread,
Jul 29, 2015, 7:17:23 PM7/29/15
to Jenkins Users, fme...@qti.qualcomm.com

did you got the answer of this? \

niristotle okram

unread,
Jul 29, 2015, 8:06:01 PM7/29/15
to Jenkins Users, fme...@qti.qualcomm.com

I am using the jenkins-cli to run a groovy script:  https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/disableEnableJobsMatchingPattern.groovy  & trying to pass these 2 parameters 
1/ jobPattern=build_git_auto 
2/ disableOrEnable=disable

Here is the command. 

[jenkins@ip-10-0-0-92 scripts]$ java -jar jenkins-cli.jar -noCertificateCheck -s https://10.0.0.91/ groovy disableEnableJobsMatchingPattern.groovy jobPattern=build_git_auto disableOrEnable=disable --username 12345 --password banana
Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
groovy.lang.MissingPropertyException: No such property: disableOrEnable for class: RemoteClass
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 RemoteClass.run(RemoteClass:19)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:266)
at groovy.lang.GroovyShell.run(GroovyShell.java:517)
at hudson.cli.GroovyCommand.run(GroovyCommand.java:94)
at hudson.cli.CLICommand.main(CLICommand.java:237)
at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
at sun.reflect.GeneratedMethodAccessor897.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:320)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:295)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:254)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)












On Friday, March 22, 2013 at 1:33:04 PM UTC-7, Merrow, Frank wrote:
Reply all
Reply to author
Forward
0 new messages