Since build 2.60, the culprits are no longer available through the json api. They are probably not available through xml api either, the root cause seems to be the same. Steps to reproduce:

      1. Go to a failed build 
        http://localhost:8080/jenkins/job/mytest/3/
      2. Check the json build result
        http://localhost:8080/jenkins/job/mytest/3/api/json
      3. Expect the json output to contain a culprits node but it no longer does 

      In changeset 39136804e53bf9f34cc91fdf3c64ab57d976eac3, method getCulprits was removed from AbstractBuild, as it already existed in the RunWithSCM interface as a default method. However, the model builder in stapler seems to only take @Exported methods from the current declaring class, and not from subclasses, so the data is no longer exported. 

      So, what are the solutions?

      1. Leave things as they are now. I think there are already a few tools on the internet that use this information. We have a dashing.io board that shows the status of various jenkins builds and this is currently broken.
      2. Expose the method back in AbstractBuild, even if just delegates to the RunWithSCM one, like in the attached patch. 
      3. Change the model behaviour in stapler to also consider exported methods from other classes in the hierarchy. I find this the most unlikely, could put out a lot of data. I doubt many use filtering on just what they need, so we would risk flooding them. 

       

       

          [JENKINS-46082] Culprits no longer available through json api

          Oleg Nenashev added a comment -

          Oleg Nenashev added a comment - Passing it to abayer , who is an author of https://github.com/jenkinsci/jenkins/commit/39136804e53bf9f34cc91fdf3c64ab57d976eac3

          Andrew Bayer added a comment -

          woo. Will investigate.

          Andrew Bayer added a comment - woo. Will investigate.

          Andrew Bayer added a comment -

          So Stapler does take the Exported annotation from superclasses, but apparently not from default methods in interfaces. That's lame.

          Andrew Bayer added a comment - So Stapler does take the Exported annotation from superclasses, but apparently not from default methods in interfaces. That's lame.

          I guess that's new feature, it did not need to, until recently .

          Aurelian Teglas added a comment - I guess that's new feature, it did not need to, until recently .

          Andrew Bayer added a comment -

          Core PR up, will have a workflow-job PR up momentarily.

          Andrew Bayer added a comment - Core PR up, will have a workflow-job PR up momentarily.

          Andrew Bayer added a comment -

          And workflow-job PR is up too.

          Andrew Bayer added a comment - And workflow-job PR is up too.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          core/src/main/java/hudson/model/AbstractBuild.java
          test/src/test/java/hudson/model/AbstractBuildTest.java
          http://jenkins-ci.org/commit/jenkins/a975f7227ee58d3f274b82e3d9b615b297f30fa0
          Log:
          [FIXED JENKINS-46082] API will include culprits again.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: core/src/main/java/hudson/model/AbstractBuild.java test/src/test/java/hudson/model/AbstractBuildTest.java http://jenkins-ci.org/commit/jenkins/a975f7227ee58d3f274b82e3d9b615b297f30fa0 Log: [FIXED JENKINS-46082] API will include culprits again.

          Oleg Nenashev added a comment -

          The fix has been integrated towards Jenkins 2.74. Marking as LTS Candidate since it is a regression in 2.60

          Oleg Nenashev added a comment - The fix has been integrated towards Jenkins 2.74. Marking as LTS Candidate since it is a regression in 2.60

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          core/src/main/java/hudson/model/AbstractBuild.java
          test/src/test/java/hudson/model/AbstractBuildTest.java
          http://jenkins-ci.org/commit/jenkins/69d8fe47ff9d60cd885aaeb3e0b91b4fcfe6ba6e
          Log:
          [FIXED JENKINS-46082] API will include culprits again.

          (cherry picked from commit a975f7227ee58d3f274b82e3d9b615b297f30fa0)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: core/src/main/java/hudson/model/AbstractBuild.java test/src/test/java/hudson/model/AbstractBuildTest.java http://jenkins-ci.org/commit/jenkins/69d8fe47ff9d60cd885aaeb3e0b91b4fcfe6ba6e Log: [FIXED JENKINS-46082] API will include culprits again. (cherry picked from commit a975f7227ee58d3f274b82e3d9b615b297f30fa0)

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
          src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
          http://jenkins-ci.org/commit/workflow-job-plugin/51a981e65f6d9d51609ffc74e9f15bdf616a4890
          Log:
          [FIXED JENKINS-46082] API will now include culprits.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java http://jenkins-ci.org/commit/workflow-job-plugin/51a981e65f6d9d51609ffc74e9f15bdf616a4890 Log: [FIXED JENKINS-46082] API will now include culprits.

            abayer Andrew Bayer
            aurelianteglas Aurelian Teglas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: