Running groovysh via the SSH server doesn't seem to work. It returns an exit 255 with no output. The who-am-i command shows i'm authenticated.
On Wed, May 2, 2012 at 10:15 AM, Carlton Brown <[email protected]> wrote: > Thanks for the explanation, I will try that. > > > On Wed, May 2, 2012 at 3:44 AM, Daniel PETISME > <[email protected]>wrote: > >> The groovysh command seems broken with the jenkins-cli.jar. >> if you use a "recent" version of Jenkins you should use the Jenkins SSH >> server to invoke the groovysh command. >> >> https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+SSH >> http://kohsuke.org/2011/12/27/jenkins-now-acts-as-an-ssh-daemon/ >> >> Cheers >> Daniel >> >> Le jeudi 26 avril 2012 17:23:50 UTC+2, Carlton Brown a écrit : >> >>> I wish to use groovysh to interact directly with Jenkins. Does it work? >>> >>> On Wed, Apr 25, 2012 at 4:58 PM, Daniel PETISME < >>> [email protected]> 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 **wh**o-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> >>>>> **gro**ovysh >>>>> 'jenkins.model.Jenkins.**instanc**e.pluginManager.**plugins.each >>>>> { println("${it.longName} - ${it.version}") };' >>>>> Exception in thread "main" java.lang.reflect.**UndeclaredTh** >>>>> rowableException >>>>> at $Proxy2.main(Unknown Source) >>>>> at hudson.cli.CLI.execute(CLI.**jav**a:271) >>>>> at hudson.cli.CLI._main(CLI.java:****417) >>>>> at hudson.cli.CLI.main(CLI.java:**3**22) >>>>> Caused by: hudson.remoting.**ProxyException**: hudson.security.** >>>>> AccessDeniedEx**ception2: anonymous is missing the Administer >>>>> permission >>>>> at hudson.security.ACL.**checkPermi**ssion(ACL.java:53) >>>>> at hudson.model.Node.**checkPermiss**ion(Node.java:381) >>>>> at hudson.cli.GroovyshCommand.**mai**n(GroovyshCommand.java:61) >>>>> at hudson.cli.CliManagerImpl.**main**(CliManagerImpl.java:92) >>>>> at sun.reflect.**GeneratedMethodAcc**essor5352.**invoke(Unknown >>>>> Source) >>>>> at sun.reflect.**DelegatingMethodAc**cessorImpl.**invoke(** >>>>> DelegatingMe**thodAccessorImpl.**java:43) >>>>> at java.lang.reflect.Method.**invok**e(Method.java:601) >>>>> at hudson.remoting.**RemoteInvocati**onHandler$**RPCRequest.perform(* >>>>> *R**emoteInvocationHandler.java:**27**4) >>>>> at hudson.remoting.**RemoteInvocati**onHandler$**RPCRequest.call(** >>>>> Remo**teInvocationHandler.java:**255) >>>>> at hudson.remoting.**RemoteInvocati**onHandler$**RPCRequest.call(** >>>>> Remo**teInvocationHandler.java:**215) >>>>> at hudson.remoting.UserRequest.**pe**rform(UserRequest.java:118) >>>>> at hudson.remoting.UserRequest.**pe**rform(UserRequest.java:48) >>>>> at hudson.remoting.Request$2.run(****Request.java:287) >>>>> at hudson.remoting.**InterceptingEx**ecutorService$1.**call(** >>>>> Intercept**ingExecutorService.**java:72) >>>>> at hudson.cli.CliManagerImpl$1.**ca**ll(CliManagerImpl.java:63) >>>>> at hudson.remoting.**InterceptingEx**ecutorService$2.**call(** >>>>> Intercept**ingExecutorService.**java:95) >>>>> at java.util.concurrent.**FutureTas**k$Sync.innerRun(**FutureTask.** >>>>> java:334) >>>>> at java.util.concurrent.**FutureTas**k.run(FutureTask.**java:166) >>>>> at java.util.concurrent.**ThreadPoo**lExecutor.runWorker(**ThreadPool* >>>>> *Executor.java:1110) >>>>> at java.util.concurrent.**ThreadPoo**lExecutor$Worker.run(**ThreadPoo >>>>> **lExecutor.java:603) >>>>> >>>> >>> >
