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

Jenkins 2.0 JSON API returns empty array elements in build "actions" array

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • Jenkins WAR: org.jenkins-ci.main:jenkins-war:2.0-beta-1
      Platform: Debian wheezy

      API responses for builds return include "actions" arrays, which are now containing both objects and arrays as elements. Prior to 2.0 this was not the case. E.g:

      {
      "actions" : [
      {

      },
      [

      ],
      {
      "causes" : [

      { "shortDescription" : "Started by upstream project \"authy_master\" build number 120", "upstreamBuild" : 120, "upstreamProject" : "authy_master", "upstreamUrl" : "job/authy_master/" }

      ]
      },
      {

      },
      ...

      Note the second element there is an empty array. Is this WAD? Returning JSON in such a format makes response parsing much more difficult.

          [JENKINS-33949] Jenkins 2.0 JSON API returns empty array elements in build "actions" array

          James Swaine added a comment -

          I created this issue 5 days ago and nobody has responded; upgrading to 'major'.

          James Swaine added a comment - I created this issue 5 days ago and nobody has responded; upgrading to 'major'.

          Oleg Nenashev added a comment -

          Uhm, cannot reproduce it.
          But looks suspicious

          Oleg Nenashev added a comment - Uhm, cannot reproduce it. But looks suspicious

          Alex added a comment - - edited

          Jenkins 2.277.1
          Just reproduced this issue.
          The same pipeline was working two days ago. And it is reproduced now. Looks like heisenbug.
          The issue prevents getting of build details with Jenkins API. In the blue ocean theme the link is not accessible too.

          Actions:

          1. Build pipeline (simple job - checkout -> deploy -> qa-java-api - ...)
          2. Get build details with Jenkins API - /job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/api/json?depth=3&pretty=true
          3. See nodes

          Expected:

          {
              "_class": "org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode",
              "actions": [
                  {},
                  {},
                  {},
                  {
                       "_class" : "io.jenkins.blueocean.listeners.NodeDownstreamBuildAction",
                       "description" : "EduPower » QA » qa-java-api #xxx",
                       "link" : {
                           "href" : "/blue/rest/organizations/jenkins/pipelines/EduPower/pipelines/QA/pipelines/qa-java-api/runs/xxx/"
                       }
                  },
                  {}
              ],
              "displayName": "Building EduPower » QA » qa-java-api",
              "iconColor": "red",
              "id": "70",
              "parents": [
                  "69"
              ],
              "running": false,
              "url": "job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/execution/node/70/"
          },
          

          Actual:

          {
              "_class": "org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode",
              "actions": [
                  {},
                  {},
                  {},
                  {},
                  {}
              ],
              "displayName": "Building EduPower » QA » qa-java-api",
              "iconColor": "red",
              "id": "70",
              "parents": [
                  "69"
              ],
              "running": false,
              "url": "job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/execution/node/70/"
          },
          

          Alex added a comment - - edited Jenkins 2.277.1 Just reproduced this issue. The same pipeline was working two days ago. And it is reproduced now. Looks like heisenbug. The issue prevents getting of build details with Jenkins API. In the blue ocean theme the link is not accessible too. Actions: Build pipeline (simple job - checkout -> deploy -> qa-java-api - ...) Get build details with Jenkins API - /job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/api/json?depth=3&pretty=true See nodes Expected: { "_class" : "org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode" , "actions" : [ {}, {}, {}, { "_class" : "io.jenkins.blueocean.listeners.NodeDownstreamBuildAction" , "description" : "EduPower » QA » qa-java-api #xxx" , "link" : { "href" : "/blue/rest/organizations/jenkins/pipelines/EduPower/pipelines/QA/pipelines/qa-java-api/runs/xxx/" } }, {} ], "displayName" : "Building EduPower » QA » qa-java-api" , "iconColor" : "red" , "id" : "70" , "parents" : [ "69" ], "running" : false , "url" : "job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/execution/node/70/" }, Actual: { "_class" : "org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode" , "actions" : [ {}, {}, {}, {}, {} ], "displayName" : "Building EduPower » QA » qa-java-api" , "iconColor" : "red" , "id" : "70" , "parents" : [ "69" ], "running" : false , "url" : "job/EduPower/job/NightlyBuild/job/s21-nightly-build/63/execution/node/70/" },

            Unassigned Unassigned
            zoetermeer James Swaine
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: