Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17929

Fail to run 'groovysh' in CLI due to insufficient permission

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cli
    • version 1.502

      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

          [JENKINS-17929] Fail to run 'groovysh' in CLI due to insufficient permission

          windyroad added a comment -

          Hi everyone.
          This issue is a big deal for me, so I'm willing to pay USD 100.00 for it.
          This offer is registered on FreedomSponsors (http://www.freedomsponsors.org/core/issue/343/fail-to-run-groovysh-in-cli-due-to-insufficient-permission).
          If you solve it (according to the acceptance criteria described there), please register on FreedomSponsors and mark it as resolved there
          I'll then check it out and gladly pay up!

          Oh, and if anyone else also wants throw in a few bucks on this, you should check out FreedomSponsors!

          windyroad added a comment - Hi everyone. This issue is a big deal for me, so I'm willing to pay USD 100.00 for it. This offer is registered on FreedomSponsors ( http://www.freedomsponsors.org/core/issue/343/fail-to-run-groovysh-in-cli-due-to-insufficient-permission ). If you solve it (according to the acceptance criteria described there), please register on FreedomSponsors and mark it as resolved there I'll then check it out and gladly pay up! Oh, and if anyone else also wants throw in a few bucks on this, you should check out FreedomSponsors!

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/cli/GroovyshCommand.java
          http://jenkins-ci.org/commit/jenkins/b9e227e65bff87949d46fc4313020428f48d0fa4
          Log:
          JENKINS-17929 Noting that authentication does not work in the groovysh command.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/cli/GroovyshCommand.java http://jenkins-ci.org/commit/jenkins/b9e227e65bff87949d46fc4313020428f48d0fa4 Log: JENKINS-17929 Noting that authentication does not work in the groovysh command.

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3008
          JENKINS-17929 Noting that authentication does not work in the groovysh command. (Revision b9e227e65bff87949d46fc4313020428f48d0fa4)

          Result = SUCCESS
          Jesse Glick : b9e227e65bff87949d46fc4313020428f48d0fa4
          Files :

          • core/src/main/java/hudson/cli/GroovyshCommand.java

          dogfood added a comment - Integrated in jenkins_main_trunk #3008 JENKINS-17929 Noting that authentication does not work in the groovysh command. (Revision b9e227e65bff87949d46fc4313020428f48d0fa4) Result = SUCCESS Jesse Glick : b9e227e65bff87949d46fc4313020428f48d0fa4 Files : core/src/main/java/hudson/cli/GroovyshCommand.java

          I've sent a pull request intended to fix this issue: https://github.com/jenkinsci/jenkins/pull/1035 .

          Dmitry Danilson added a comment - I've sent a pull request intended to fix this issue: https://github.com/jenkinsci/jenkins/pull/1035 .

          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.

          SCM/JIRA link daemon added a comment - 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.

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3093
          [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main. (Revision 3896aabc0bee39fd94366f5b2dd6bc191c040e40)

          Result = SUCCESS
          Jesse Glick : 3896aabc0bee39fd94366f5b2dd6bc191c040e40
          Files :

          • test/src/test/java/hudson/cli/GroovyshCommandTest.java
          • test/src/main/java/hudson/cli/CLICommandInvoker.java
          • changelog.html
          • core/src/main/java/hudson/cli/GroovyshCommand.java
          • core/src/main/java/hudson/cli/CLICommand.java

          dogfood added a comment - Integrated in jenkins_main_trunk #3093 [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main. (Revision 3896aabc0bee39fd94366f5b2dd6bc191c040e40) Result = SUCCESS Jesse Glick : 3896aabc0bee39fd94366f5b2dd6bc191c040e40 Files : test/src/test/java/hudson/cli/GroovyshCommandTest.java test/src/main/java/hudson/cli/CLICommandInvoker.java changelog.html core/src/main/java/hudson/cli/GroovyshCommand.java core/src/main/java/hudson/cli/CLICommand.java

          Code changed in jenkins
          User: Jesse Glick
          Path:
          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/6d88c0175cba3d96273da58b4c3a0e57fcd36203
          Log:
          [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main.
          (cherry picked from commit 3896aabc0bee39fd94366f5b2dd6bc191c040e40)

          Conflicts:
          changelog.html
          core/src/main/java/hudson/cli/GroovyshCommand.java

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: 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/6d88c0175cba3d96273da58b4c3a0e57fcd36203 Log: [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main. (cherry picked from commit 3896aabc0bee39fd94366f5b2dd6bc191c040e40) Conflicts: changelog.html core/src/main/java/hudson/cli/GroovyshCommand.java

          Code changed in jenkins
          User: Jesse Glick
          Path:
          http://jenkins-ci.org/commit/jenkins/0b2068661dec858d585dba9855b6127793611663
          Log:
          JENKINS-17929 Noting that authentication does not work in the groovysh command.
          (cherry picked from commit b9e227e65bff87949d46fc4313020428f48d0fa4)

          Conflicts:
          core/src/main/java/hudson/cli/GroovyshCommand.java

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: http://jenkins-ci.org/commit/jenkins/0b2068661dec858d585dba9855b6127793611663 Log: JENKINS-17929 Noting that authentication does not work in the groovysh command. (cherry picked from commit b9e227e65bff87949d46fc4313020428f48d0fa4) Conflicts: core/src/main/java/hudson/cli/GroovyshCommand.java

          Code changed in jenkins
          User: Jesse Glick
          Path:
          test/src/main/java/hudson/cli/CLICommandInvoker.java
          http://jenkins-ci.org/commit/jenkins-test-harness/f94319ea917a13d0d854e5c53a673efd96c42aff
          Log:
          [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main.
          Originally-Committed-As: 3896aabc0bee39fd94366f5b2dd6bc191c040e40

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: test/src/main/java/hudson/cli/CLICommandInvoker.java http://jenkins-ci.org/commit/jenkins-test-harness/f94319ea917a13d0d854e5c53a673efd96c42aff Log: [FIXED JENKINS-17929] Pick up transport authentication from groovysh command, by overriding run rather than main. Originally-Committed-As: 3896aabc0bee39fd94366f5b2dd6bc191c040e40

            jglick Jesse Glick
            zxkane Meng Xin Zhu
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: