Simple and effective non-blocking Jenkins API wrapper written in Java
Jenkins4J supports the following actions:
- Get all publicly (or protected, using authentication) available jobs from a Jenkins instance
- Parse job data for builds and metadata
- Parse job data for artifacts and metadata
Jenkins4J uses the Jenkins remote access JSON API (in the future, XML support may be added). Retrofit is used as the HTTP client, Gson is used for JSON deserialization and general Guava utilities are used throughout Jenkins4J.
In order to get started, create a new Jenkins
instance using a JenkinsBuilder
, like this:
final Jenkins jenkins = Jenkins.newBuilder().withPath("https://your.jenkins.path/").build();
If you need to authenticate against the Jenkins server, use the withBasicAuthentication
method in
the Jenkins builder
Using this instance, you can fetch the master node, available jobs, specific job information and/or specific build information.
There are two types of objects that you will encounter when working with Jenkins4J:
- description
- info
A description is a simple member of an info class, and it will often just contain a name or a number.
You can use a description to get a (CompletableFuture of
) an information class. Information classes
contain references to child nodes, and a bunch of meta data. This is to mirror how the Jenkins API works.
You can use description classes to retrieve their corresponding information classes, by using getParent()
.
All information classes can also be retrieved using the Jenkins instance.
Retrieval of objects will always be non-blocking, and return CompletableFuture
's.
Examples can be found in the examples directory.
JavaDoc can be found in the docs directory.
Jenkins4J is using the JitPack maven repository.
To use it, add the following repository:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
and the following dependency:
<dependency>
<groupId>com.github.Sauilitired</groupId>
<artifactId>Jenkins4J</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
Jenkins4J is on Jenkins. The job can be found here!
Contributions are very welcome! The project uses the Google Java code style. The project is licensed under the MIT license.
If you have any further questions or feedback, then feel free to join our Discord.
If the project helped you, then you are free to give me some coffee money via PayPal
☕