Reputation: 4811
I am searching some Jenkins client frameworks to deal with Jenkins server.I have found a good and updated Jenkins client server API called RisingOak/jenkins-client
Connectivity with Jenkins Server
JenkinsServer jenkins = new JenkinsServer(new URI("http://localhost:8080/jenkins"), "admin", "password")
I have setup multiple projects in Jenkins so i want to get list of jobs details for each project using Jenkings client like in Jenkings server left side list.
If anyone families with RisingOak/jenkins-client or any other APIs Please let me know how to achieve this.
Upvotes: 4
Views: 2161
Reputation: 4811
Finally looked deep into RisingOak/jenkins-client and found a way to achieve it.
JenkinsServer js = new JenkinsServer(URI.create("Your Jenkins URL"));
MavenJobWithDetails mavenJob = js.getMavenJob("Your project Name inside server");
//get last Successful build
BuildWithDetails details = mavenJob.getLastSuccessfulBuild().details();
//get job details
System.out.println("Build Number: " + details.getNumber());
or iterate list of jobs
for(MavenBuild items : mavenJob.getBuilds())
{
details=items.details();
System.out.println(details.getFullDisplayName());
}
More details here.
Upvotes: 2