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

Cannot trigger Jenkins Workflow DSL jobs with jenkins-cli

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • cli, pipeline
    • Kubernetes, Jenkernetes docker image

      Using the list command I can see the workflow jobs returned but when I try the build or console commands an error is returned saying the job could not be found. I created a test freestyle project and that can be triggered so it only affects the workflow jobs.

      bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8 list-jobs
      workflow-job1
      freestyle-job1
      

      Error:

      bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console workflow-job1
      No such job 'workflow-job1'; perhaps you meant 'freestyle-job1'?
      java -jar jenkins-cli.jar console JOB [BUILD] [-f] [-n N]
      Produces the console output of a specific build to stdout, as if you are doing 'cat build.log'
       JOB   : Name of the job
       BUILD : Build number or permalink to point to the build. Defaults to the last
               build
       -f    : If the build is in progress, stay around and append console output as
               it comes, like 'tail -f'
       -n N  : Display the last N lines
      

      The freestyle job works correctly..

      bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console freestyle-job1
      Started from command line by ha:AAAAmx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgZ+/dLi1CL9xLz8vMrc/NJiAJjzDjjEAAAAanonymous
      Building in workspace /var/jenkins_home/jobs/freestyle-job1/workspace
      [workspace] $ /bin/sh -xe /tmp/hudson1774308920514103607.sh
      + echo worked
      worked
      Finished: SUCCESS
      

          [JENKINS-29826] Cannot trigger Jenkins Workflow DSL jobs with jenkins-cli

          James Rawlings created issue -

          James Rawlings added a comment - - edited

          I've just noticed this error in the jenkins logs..

          Aug 07, 2015 11:54:11 AM hudson.cli.handlers.GenericItemOptionHandler$1 run
          WARNING: running as anonymous could not find org.jenkinsci.plugins.workflow.job.WorkflowJob@75969b96[workflow-job1] of class hudson.model.AbstractProject

          James Rawlings added a comment - - edited I've just noticed this error in the jenkins logs.. Aug 07, 2015 11:54:11 AM hudson.cli.handlers.GenericItemOptionHandler$1 run WARNING: running as anonymous could not find org.jenkinsci.plugins.workflow.job.WorkflowJob@75969b96[workflow-job1] of class hudson.model.AbstractProject
          James Rawlings made changes -
          Description Original: Using the list command I can see the workflow jobs returned but when I try the build or console commands an error is returned saying the job could not be found. I created a test freestyle project and that can be triggered so it only affects the workflow jobs.

          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8 list-jobs
          workflow-job1
          freestyle-job1


          Error:

          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console workflow-job1
          No such job 'workflow-job1'; perhaps you meant 'freestyle-job1'?
          java -jar jenkins-cli.jar console JOB [BUILD] [-f] [-n N]
          Produces the console output of a specific build to stdout, as if you are doing 'cat build.log'
           JOB : Name of the job
           BUILD : Build number or permalink to point to the build. Defaults to the last
                   build
           -f : If the build is in progress, stay around and append console output as
                   it comes, like 'tail -f'
           -n N : Display the last N lines



          The freestyle job works correctly..

          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console freestyle-job1
          Started from command line by ha:AAAAmx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgZ+/dLi1CL9xLz8vMrc/NJiAJjzDjjEAAAAanonymous
          Building in workspace /var/jenkins_home/jobs/freestyle-job1/workspace
          [workspace] $ /bin/sh -xe /tmp/hudson1774308920514103607.sh
          + echo worked
          worked
          Finished: SUCCESS
          New: Using the list command I can see the workflow jobs returned but when I try the build or console commands an error is returned saying the job could not be found. I created a test freestyle project and that can be triggered so it only affects the workflow jobs.
          {code}
          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8 list-jobs
          workflow-job1
          freestyle-job1
          {code}

          Error:
          {code}
          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console workflow-job1
          No such job 'workflow-job1'; perhaps you meant 'freestyle-job1'?
          java -jar jenkins-cli.jar console JOB [BUILD] [-f] [-n N]
          Produces the console output of a specific build to stdout, as if you are doing 'cat build.log'
           JOB : Name of the job
           BUILD : Build number or permalink to point to the build. Defaults to the last
                   build
           -f : If the build is in progress, stay around and append console output as
                   it comes, like 'tail -f'
           -n N : Display the last N lines
          {code}


          The freestyle job works correctly..
          {code}
          bash-4.3# java -jar jenkins-cli.jar -s http://jenkins.vagrant.f8/ console freestyle-job1
          Started from command line by ha:AAAAmx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgZ+/dLi1CL9xLz8vMrc/NJiAJjzDjjEAAAAanonymous
          Building in workspace /var/jenkins_home/jobs/freestyle-job1/workspace
          [workspace] $ /bin/sh -xe /tmp/hudson1774308920514103607.sh
          + echo worked
          worked
          Finished: SUCCESS
          {code}
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-28071 [ JENKINS-28071 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Here's my attempt at fixing this: https://github.com/jenkinsci/jenkins/pull/1979

          David McFarland added a comment - Here's my attempt at fixing this: https://github.com/jenkinsci/jenkins/pull/1979
          David McFarland made changes -
          Comment [ What can I do to move this along? ]

          Code changed in jenkins
          User: David McFarland
          Path:
          core/src/main/java/hudson/cli/BuildCommand.java
          core/src/main/java/hudson/cli/handlers/JobOptionHandler.java
          http://jenkins-ci.org/commit/jenkins/6ceccc0cc4ff20915f395accf9775c27975c5c3d
          Log:
          JENKINS-28071 generalise CLI's BuildCommand target from AbstractProject to Job (#1979)

          • JENKINS-28071 generalise BuildCommand target from AbstractProject to Job

          This allows e.g. WorkflowJob to build, fixing symptom JENKINS-29826

          • fixup! JENKINS-28071 generalise BuildCommand target from AbstractProject to Job
          • fixup! JENKINS-28071 generalise BuildCommand target from AbstractProject to Job

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: David McFarland Path: core/src/main/java/hudson/cli/BuildCommand.java core/src/main/java/hudson/cli/handlers/JobOptionHandler.java http://jenkins-ci.org/commit/jenkins/6ceccc0cc4ff20915f395accf9775c27975c5c3d Log: JENKINS-28071 generalise CLI's BuildCommand target from AbstractProject to Job (#1979) JENKINS-28071 generalise BuildCommand target from AbstractProject to Job This allows e.g. WorkflowJob to build, fixing symptom JENKINS-29826 fixup! JENKINS-28071 generalise BuildCommand target from AbstractProject to Job fixup! JENKINS-28071 generalise BuildCommand target from AbstractProject to Job
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 164903 ] New: JNJira + In-Review [ 197577 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]

            jglick Jesse Glick
            rawlingsj James Rawlings
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: