How to get a list of Jenkins work details using the Jenkins client in Java

I am looking for several Jenkins client frameworks for working with the Jenkins server. I found a nice and updated Jenkins client server API called RisingOak / jenkins-client

Communication with Jenkins Server

JenkinsServer jenkins = new JenkinsServer(new URI("http://localhost:8080/jenkins"), "admin", "password")

I have several projects in Jenkins, so I want to get a list of tasks for each project using the Jenkings client, for example, in the left list of Jenkings servers.

If any families with RisingOak / jenkins-client or any other APIs please let me know how to achieve this.

enter image description here

+4
source share
1 answer
, RisingOak/jenkins-client .
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());

for(MavenBuild items : mavenJob.getBuilds())
 {

    details=items.details();
    System.out.println(details.getFullDisplayName());
 }

.

+2

Source: https://habr.com/ru/post/1615695/


All Articles