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

Jenkins remote access api doesn't provide the job name for pipeline jobs when getting the build queue

    XMLWordPrintable

Details

    Description

      I try to query the jobs in the build queue by using /queue/api/json?pretty url. I get the result, however, it doesn't contain the names of the pipeline jobs in certain cases.

      If a pipeline job has concurrent builds disabled then I get the following:

       

      {
        "_class" : "hudson.model.Queue$BlockedItem",
        "id" : 319,
        "task" : {
          "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowJob",
          "name" : "test-pipeline1"
        },
        "why" : "Build #1 is already in progress (ETA: N/A)"
      },

       

      So far so good, I can see the job name (test-pipeline1). However, if concurrent builds are enabled, then there's no "name" reference in the json result. Note that the pipeline job below uses lockable resources. And while waiting for the given resource to be available I get the results below, without the job name.

       

       

      {
       "_class" : "hudson.model.Queue$BuildableItem",
       "actions" : [
       
       ],
       "blocked" : False,
       "buildable" : True,
       "id" : 334,
       "inQueueSince" : 1585896210314,
       "params" : "",
       "stuck" : False,
       "task" : {
       "_class" : "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
       },
       "url" : "queue/item/334/",
       "why" : "Waiting for next available executor on 'pod-name'",
       "buildableStartMilliseconds" : 1585896210315,
       "pending" : False
       },
      

       

      So my question is how to get the job name in the build queue api call. Btw. I tested with the xml and python output as well, they both miss the job name.

       

       

      Attachments

        Activity

          tavolodobela Bela Tavolodo created issue -
          tavolodobela Bela Tavolodo made changes -
          Field Original Value New Value
          Description I try to query the jobs in the build queue by using /queue/api/json?pretty url. I get the result, however, it doesn't contain the names of the pipeline jobs in certain cases.

          If a pipeline job has concurrent builds disabled then I get the following:

          {{}}
          {code:java}
          {
            "_class" : "hudson.model.Queue$BlockedItem",
            "id" : 319,
            "task" : {
              "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowJob",
              "name" : "test-pipeline1"
            },
            "why" : "Build #1 is already in progress (ETA: N/A)"
          },{code}
          {{}}

          {{}}

          {{}}So far so good, I can see the job name (test-pipeline1). However, if concurrent builds are enabled, then there's no "name" reference in the json result. Note that the pipeline job below uses lockable resources. And while waiting for the given resource to be available I get the results below, without the job name.

           

           
          {code:java}
          {
           "_class" : "hudson.model.Queue$BuildableItem",
           "actions" : [
           
           ],
           "blocked" : False,
           "buildable" : True,
           "id" : 334,
           "inQueueSince" : 1585896210314,
           "params" : "",
           "stuck" : False,
           "task" : {
           "_class" : "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
           },
           "url" : "queue/item/334/",
           "why" : "Waiting for next available executor on 'pod-name'",
           "buildableStartMilliseconds" : 1585896210315,
           "pending" : False
           },
          {code}
           

          So my question is how to get the job name in the build queue api call. Btw. I tested with the xml and python output as well, they both miss the job name.

           

           
          I try to query the jobs in the build queue by using /queue/api/json?pretty url. I get the result, however, it doesn't contain the names of the pipeline jobs in certain cases.

          If a pipeline job has concurrent builds disabled then I get the following:

           
          {code:java}
          {
            "_class" : "hudson.model.Queue$BlockedItem",
            "id" : 319,
            "task" : {
              "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowJob",
              "name" : "test-pipeline1"
            },
            "why" : "Build #1 is already in progress (ETA: N/A)"
          },{code}
           

          So far so good, I can see the job name (test-pipeline1). However, if concurrent builds are enabled, then there's no "name" reference in the json result. Note that the pipeline job below uses lockable resources. And while waiting for the given resource to be available I get the results below, without the job name.

           

           
          {code:java}
          {
           "_class" : "hudson.model.Queue$BuildableItem",
           "actions" : [
           
           ],
           "blocked" : False,
           "buildable" : True,
           "id" : 334,
           "inQueueSince" : 1585896210314,
           "params" : "",
           "stuck" : False,
           "task" : {
           "_class" : "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
           },
           "url" : "queue/item/334/",
           "why" : "Waiting for next available executor on 'pod-name'",
           "buildableStartMilliseconds" : 1585896210315,
           "pending" : False
           },
          {code}
           

          So my question is how to get the job name in the build queue api call. Btw. I tested with the xml and python output as well, they both miss the job name.

           

           

          tgr I am facing same issue with pipeline jobs, but the Job name is being provided only for FreeStyleJobs. 

          Same issue: https://issues.jenkins-ci.org/browse/JENKINS-10468?focusedCommentId=161967&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-161967

          vmamidala Vijaykumar Mamidala added a comment - tgr I am facing same issue with pipeline jobs, but the Job name is being provided only for FreeStyleJobs.  Same issue:  https://issues.jenkins-ci.org/browse/JENKINS-10468?focusedCommentId=161967&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-161967
          tgr Tobias Gruetzmacher made changes -
          Assignee Tobias Gruetzmacher [ tgr ]

          People

            Unassigned Unassigned
            tavolodobela Bela Tavolodo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: