jenkinsci / jenkinsci/java-client-api

JobWithDetails.getAllBuilds() throws Exception with 404

Open
#490 2 comments 0 reactions 0 assignees View on GitHub
bug
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

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.