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

Cannot trigger Jenkins Workflow DSL jobs with jenkins-cli

    Details

    • Similar Issues:

      Description

      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
      

        Attachments

          Issue Links

            Activity

            rawlingsj James Rawlings created issue -
            Hide
            rawlingsj 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
            Show
            rawlingsj 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
            rawlingsj James Rawlings made changes -
            Field Original Value New Value
            Description 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
            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}
            jglick Jesse Glick made changes -
            Link This issue duplicates JENKINS-28071 [ JENKINS-28071 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Duplicate [ 3 ]
            Hide
            corngood David McFarland added a comment -

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

            Show
            corngood David McFarland added a comment - Here's my attempt at fixing this: https://github.com/jenkinsci/jenkins/pull/1979
            corngood David McFarland made changes -
            Comment [ What can I do to move this along? ]
            Hide
            scm_issue_link 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
            Show
            scm_issue_link 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
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 164903 ] JNJira + In-Review [ 197577 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            abayer Andrew Bayer made changes -
            Labels jenkins workflow jenkins pipeline workflow
            abayer Andrew Bayer made changes -
            Labels jenkins pipeline workflow jenkins pipeline

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: