jenkinsci / jenkinsci/java-client-api
JobWithDetails.getAllBuilds() throws Exception with 404
- Dominant language
- Java
- Stars
- 913
- Forks
- 466
- PR merge metrics
- No merged PRs in 30d
Description
My job has many builds, but I got null when call `jenkinsServer.getJob("Folder1/Folder2/jobName").getAllBuilds()`.
Then I check the source code, and find:
```
List builds = client.get(path + "job/" + EncodingUtils.encode(this.getName())
+ "?tree=allBuilds[number[*],url[*],queueId[*]]", AllBuilds.class).getAllBuilds();
```
The problem is `this.getName()`. My job's full path is :
`/job/Folder1/job/Folder2/job/jobName`
But this.getName() only returns jobName.
So I can get correct results with this:
```
List builds = client.get("/job/Folder1/job/Folder2/job/jobName"
+ "?tree=allBuilds[number[*],url[*],queueId[*]]", AllBuilds.class).getAllBuilds();
```
Contributor guide
Research direction
Start at JobWithDetails.getAllBuilds() and inspect how the Jenkins path is assembled when getName() is used. Compare that path with the nested-job path shown in the report; done means getAllBuilds() returns the builds for jobs such as Folder1/Folder2/jobName instead of failing with a 404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100