Details
-
Bug
-
Status: Resolved (View Workflow)
-
Major
-
Resolution: Fixed
-
version 1.502
Description
1: verified that I am authenticated: java -jar jenkins-cli.jar -s http://myserver/jenkins who-am-i
Authenticated as: myuser
Authorities:
authenticated
2: tried to run a trivial script via groovysh and got an error
java -jar jenkins-cli.jar -s http://myserver/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
The workaround is using command 'groovy' instead.
java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ groovy test_script.gsh
It's also discussed in group.[1]
[1] https://groups.google.com/forum/#!msg/jenkinsci-users/Vb1p7tbWfQk/4vcVrHOC19MJ
Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/cli/CLICommand.java
core/src/main/java/hudson/cli/GroovyshCommand.java
test/src/main/java/hudson/cli/CLICommandInvoker.java
test/src/test/java/hudson/cli/GroovyshCommandTest.java
http://jenkins-ci.org/commit/jenkins/3896aabc0bee39fd94366f5b2dd6bc191c040e40
Log:
[FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main.