jenkinsci / jenkinsci/java-client-api

Unable to fetch build details

Open
#284 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
913
Forks
466
PR merge metrics
No merged PRs in 30d

Description

Hi ! I'm currently working with Jenkins (v2.65). I want to get details from builds but I'm unable to do so. Here a sample of my code (Some checks are skipped).

Map jobs = null;
JobWithDetails jobWithDetails;

jobs = Config.jenkins.getJobs();

for (Map.Entry entry : jobs.entrySet()) {

jobWithDetails = Config.jenkins.getJob(entry.getKey());

if (jobWithDetails != null) {
List list = null;
BuildWithDetails buildWithDetails = null;

list = jobWithDetails.getAllBuilds();

for (Build build : list) {
Build tmp_b = jobWithDetails.getBuildByNumber(build.getNumber());

buildWithDetails = tmp_b.details();

if (buildWithDetails != null)
// Do something....
else
System.out.println("Cannot retrieved 'BuildWithDetails'.");
}
}
}

> `Config.jenkins` is nothing more than a `JenkinsServer` instance.

I do mostly the same as @khmarbaise on issue #138 but `buildWithDetails` keep being equal to null.
Here a screenshot to illustrate :

![image](https://user-images.githubusercontent.com/11960724/30318093-65d24370-97ac-11e7-8d60-c18d69a862fe.png)

Notice that I have to use `jobWithDetails = Config.jenkins.getJob(entry.getKey());` to get a valid `JobWithDetail` instance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.