Open oksanamekh opened 5 years ago
Can you please give more details like which Jenkins version you are using? Have you tried to separate the steps and don't chain them like this:
JobWithDetails details = jenkinsServer.getJob(jobName);
List<Build> builds = details.getAllBuilds();
I think the first thing details
will already be null based on a wrong jobName?
Hi, @khmarbaise! Thank you very much for answer.
I am using Jenkins version 2.144 and this library version 0.3.8.
Yes, I have tried way that you suggest, and I can say, that my problem is not in this.
My jobName
is right and details
is not null, but after running
List<Build> builds = details.getAllBuilds();
variable builds
still has null value. You can see proof of it on attached screenshot (1).
On second screenshot I show code of getAllBuilds()
method, and you can see that I get null as metod result exactly in that catch block I mentioned before.
Also I will add stacktrace of that exception, may be it will helpful to understand something.
com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11)
com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:152)
com.offbytwo.jenkins.model.JobWithDetails.getAllBuilds(JobWithDetails.java:126)
com.oksanamekh.JenkinsTest.main(JenkinsTest.java:32)
Can you now answer to my question? I am ready to give all needed information you will ask, because this issue is important for me.
I look forward to answer. Thank you for help!
I found out one important fact just now.
My jobName
from example screenshot above consists of folder job (MCT) and internal job (MCT-build).
But when I try to use this method only with folder job, or other job in my Jenkins root, method works correctly!
So, I see that method getAllBuilds()
does not work with nested jobs.
I searched for the cause and I can say, that in case of nested jobs wrong URI path is being built. Right path to my job is next: http://192.168.242.56:8080/job/MCT/job/MCT-build/ But during method running piece "/job/MCT" is lost.
I will attach screenshot to explain where I found this.
Hello. I try to use this library and I met some issue.
I want to retrieve all builds for job and I write:
List<Build> builds = jenkinsServer.getJob(jobName).getAllBuilds();
This method always returns null. Method
getAllBuilds(Range range)
returns null too, but I see warning about this in documentation. Only methodgetBuilds()
works correctly. In documentation forgetAllBuilds()
method there is no information about problems with it.I found that null returns in
catch (HttpResponseException e)
block ingetAllBuilds()
:So, I want to ask, is this only my problem, or not? Has anyone been getting this issue? And how I can fix it or circumvent it?
Maybe you already know about this problem and plan to solve it? Then, perhaps, you can tell how quickly this problem will be solved.
Hope for answer. Thanks in advance.