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

list-jobs CLI command should not list ItemgGroups of any items but TopLevelItems

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • cli
    • None

      Currently, list-jobs command tries to list any ItemGroups (including MavenModuleSet or MatrixProject which does not make sense). It should list instances of View and ItemGroup<? extends TopLevelItem> exclusively.

      jenkins-cli.jar list-jobs MyMatrixJob fails with:

      java.lang.ClassCastException: hudson.matrix.MatrixConfiguration cannot be cast to hudson.model.TopLevelItem
      	at hudson.cli.ListJobsCommand.run(ListJobsCommand.java:88)
      	at hudson.cli.CLICommand.main(CLICommand.java:229)
      	at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:282)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:263)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:222)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	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:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      	at java.lang.Thread.run(Thread.java:662)
      

          [JENKINS-18393] list-jobs CLI command should not list ItemgGroups of any items but TopLevelItems

          Oliver Gondža created issue -
          Oliver Gondža made changes -
          Description New: Currently, {{list-jobs}} command tries to list any {{ItemGroups}} (including {{MavenModuleSet}} or {{MatrixProject}} which does not make sense). It should list instances of {{View}} and {{ItemGroup<? extends TopLevelItem>}} exclusively.

          {{jenkins-cli.jar list-jobs MyMatrixJob}} fails with:
          {noformat}
          java.lang.ClassCastException: hudson.matrix.MatrixConfiguration cannot be cast to hudson.model.TopLevelItem
          at hudson.cli.ListJobsCommand.run(ListJobsCommand.java:88)
          at hudson.cli.CLICommand.main(CLICommand.java:229)
          at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:282)
          at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:263)
          at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:222)
          at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          at hudson.remoting.Request$2.run(Request.java:326)
          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:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
          at java.lang.Thread.run(Thread.java:662)
          {noformat}
          Summary Original: list-jobs CLI command should list TopLevelItems exclusively New: list-jobs CLI command should not list ItemgGroups of any items but TopLevelItems

          Oliver Gondža added a comment - https://github.com/jenkinsci/jenkins/pull/823

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          core/src/main/java/hudson/cli/ListJobsCommand.java
          core/src/test/java/hudson/cli/ListJobsCommandTest.java
          http://jenkins-ci.org/commit/jenkins/38412a94555a18ddb97fc5d9dcd78e983bb3856f
          Log:
          [fixed JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command

          List item group recursively.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/cli/ListJobsCommand.java core/src/test/java/hudson/cli/ListJobsCommandTest.java http://jenkins-ci.org/commit/jenkins/38412a94555a18ddb97fc5d9dcd78e983bb3856f Log: [fixed JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command List item group recursively.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          core/src/main/java/hudson/cli/ListJobsCommand.java
          core/src/test/java/hudson/cli/ListJobsCommandTest.java
          http://jenkins-ci.org/commit/jenkins/f8ec806d74ae31b96e904a1572dfff389c94632d
          Log:
          Merge pull request #823 from olivergondza/jenkins18393

          [FIXED JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command

          Compare: https://github.com/jenkinsci/jenkins/compare/ec3338078861...f8ec806d74ae

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/cli/ListJobsCommand.java core/src/test/java/hudson/cli/ListJobsCommandTest.java http://jenkins-ci.org/commit/jenkins/f8ec806d74ae31b96e904a1572dfff389c94632d Log: Merge pull request #823 from olivergondza/jenkins18393 [FIXED JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command Compare: https://github.com/jenkinsci/jenkins/compare/ec3338078861...f8ec806d74ae

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2949
          [fixed JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command (Revision 38412a94555a18ddb97fc5d9dcd78e983bb3856f)

          Result = SUCCESS
          ogondza : 38412a94555a18ddb97fc5d9dcd78e983bb3856f
          Files :

          • core/src/main/java/hudson/cli/ListJobsCommand.java
          • core/src/test/java/hudson/cli/ListJobsCommandTest.java

          dogfood added a comment - Integrated in jenkins_main_trunk #2949 [fixed JENKINS-18393] Do not list any ItemGroup in list-jobs CLI command (Revision 38412a94555a18ddb97fc5d9dcd78e983bb3856f) Result = SUCCESS ogondza : 38412a94555a18ddb97fc5d9dcd78e983bb3856f Files : core/src/main/java/hudson/cli/ListJobsCommand.java core/src/test/java/hudson/cli/ListJobsCommandTest.java
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 149700 ] New: JNJira + In-Review [ 193249 ]

            olivergondza Oliver Gondža
            olivergondza Oliver Gondža
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: