I wish to use groovysh to interact directly with Jenkins.   Does it work?

On Wed, Apr 25, 2012 at 4:58 PM, Daniel PETISME <daniel.peti...@gmail.com>wrote:

> Hi Carlton,
>
> Jenkins-cli seems to have some issues concerning authentication. Groovysh
> allows you to interact directly with the Jenkins JVM using the goovy
> language.
>
> If you don't need this "interaction" prefer the groovy command as a
> possible workaround
>
>
> For instance.
>
> $ java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ -i
> <myKeyFile> groovy test_script.gsh
> Enter passphrase for <myKeyFile>:
> ant - 1.1
> javadoc - 1.0
> Jenkins CVS Plug-in - 1.6
> Maven Integration plugin - 1.460
> Jenkins SSH Slaves plugin - 0.21
> Jenkins Subversion Plug-in - 1.34
> Jenkins Translation Assistance plugin - 1.8
>
> and the test_script.gsh is reusing your command
> "jenkins.model.Jenkins.instance.pluginManager.plugins.each {
> println("${it.longName} - ${it.version}") }"
>
> I try to add more details concerning jenkins-cli.jar tool: Jenkins CLI in
> Dev 
> ML<https://groups.google.com/forum/?fromgroups#%21topic/jenkinsci-dev/Es4nvtZVyj0>
>
> To skip the step of the creation of a groovy script file for each command,
> the usage talks about a pramater "=" to write the command in stdin.
>
> Cheers
>
> Daniel
>
>
> On Wednesday, April 25, 2012 4:27:14 PM UTC+2, Carlton Brown wrote:
>>
>> Steps to reproduce:
>> 1:  set up an SSH key under my username
>> 2:  verified that I am authenticated:  java -jar jenkins-cli.jar -s
>> http://myserver/jenkins  **who-am-i
>>      Authenticated as: myuser
>>     Authorities:
>>         authenticated
>> 3:  tried to run a trivial script via groovysh and got an error
>>   java -jar jenkins-cli.jar -s 
>> http://myserver/jenkins<http://vbuild06.atld1:8080/jenkins>
>>  **groovysh 'jenkins.model.Jenkins.**instance.pluginManager.**plugins.each
>> { println("${it.longName} - ${it.version}") };'
>> Exception in thread "main" java.lang.reflect.**
>> UndeclaredThrowableException
>> at $Proxy2.main(Unknown Source)
>> at hudson.cli.CLI.execute(CLI.**java:271)
>>  at hudson.cli.CLI._main(CLI.java:**417)
>> at hudson.cli.CLI.main(CLI.java:**322)
>> Caused by: hudson.remoting.**ProxyException: 
>> hudson.security.**AccessDeniedException2:
>> anonymous is missing the Administer permission
>>  at hudson.security.ACL.**checkPermission(ACL.java:53)
>> at hudson.model.Node.**checkPermission(Node.java:381)
>> at hudson.cli.GroovyshCommand.**main(GroovyshCommand.java:61)
>>  at hudson.cli.CliManagerImpl.**main(CliManagerImpl.java:92)
>> at sun.reflect.**GeneratedMethodAccessor5352.**invoke(Unknown Source)
>>  at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
>> DelegatingMethodAccessorImpl.**java:43)
>> at java.lang.reflect.Method.**invoke(Method.java:601)
>>  at hudson.remoting.**RemoteInvocationHandler$**RPCRequest.perform(**
>> RemoteInvocationHandler.java:**274)
>> at hudson.remoting.**RemoteInvocationHandler$**RPCRequest.call(**
>> RemoteInvocationHandler.java:**255)
>>  at hudson.remoting.**RemoteInvocationHandler$**RPCRequest.call(**
>> RemoteInvocationHandler.java:**215)
>> at hudson.remoting.UserRequest.**perform(UserRequest.java:118)
>>  at hudson.remoting.UserRequest.**perform(UserRequest.java:48)
>> at hudson.remoting.Request$2.run(**Request.java:287)
>>  at hudson.remoting.**InterceptingExecutorService$1.**call(**
>> InterceptingExecutorService.**java:72)
>> at hudson.cli.CliManagerImpl$1.**call(CliManagerImpl.java:63)
>>  at hudson.remoting.**InterceptingExecutorService$2.**call(**
>> InterceptingExecutorService.**java:95)
>> at java.util.concurrent.**FutureTask$Sync.innerRun(**FutureTask.java:334)
>>  at java.util.concurrent.**FutureTask.run(FutureTask.**java:166)
>> at java.util.concurrent.**ThreadPoolExecutor.runWorker(**
>> ThreadPoolExecutor.java:1110)
>>  at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**
>> ThreadPoolExecutor.java:603)
>>
>

Reply via email to