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


      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.



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