Jenkins SDK

Jenkins XML API wrapper written in Java.

License

License

Categories

Categories

Jenkins Build Tools Continuous Integration and Continuous Delivery
GroupId

GroupId

com.github.aistomin
ArtifactId

ArtifactId

jenkins-sdk
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

Jenkins SDK
Jenkins XML API wrapper written in Java.
Project URL

Project URL

https://github.com/aistomin/jenkins-sdk
Source Code Management

Source Code Management

https://github.com/aistomin/jenkins-sdk

Download jenkins-sdk

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.aistomin/jenkins-sdk/ -->
<dependency>
    <groupId>com.github.aistomin</groupId>
    <artifactId>jenkins-sdk</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.aistomin/jenkins-sdk/
implementation 'com.github.aistomin:jenkins-sdk:0.2.1'
// https://jarcasting.com/artifacts/com.github.aistomin/jenkins-sdk/
implementation ("com.github.aistomin:jenkins-sdk:0.2.1")
'com.github.aistomin:jenkins-sdk:jar:0.2.1'
<dependency org="com.github.aistomin" name="jenkins-sdk" rev="0.2.1">
  <artifact name="jenkins-sdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.aistomin', module='jenkins-sdk', version='0.2.1')
)
libraryDependencies += "com.github.aistomin" % "jenkins-sdk" % "0.2.1"
[com.github.aistomin/jenkins-sdk "0.2.1"]

Dependencies

compile (7)

Group / Artifact Type Version
commons-io : commons-io jar 2.5
org.apache.httpcomponents : fluent-hc jar 4.5.2
org.apache.httpcomponents : httpclient jar 4.5.2
org.apache.httpcomponents : httpcore jar 4.4.5
commons-codec : commons-codec jar 1.10
com.jcabi : jcabi-xml jar 0.17.2
org.apache.commons : commons-lang3 jar 3.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-core jar 1.3

Project Modules

There are no modules declared in this project.

JENKINS-SDK

Build Status Maven Central

See: Documentation and Examples for more details.

Purpose

This project is object oriented Java SDK for Jenkins XML API that is going to help developers to manipulate Jenkins instance using it's API. This SDK can be useful for developers who creates CI scripts or other environment software that needs to read information from Jenkins, trigger builds etc. Java 7 or higher is required.

Add Maven Dependency

Add the following configuration to your project's pom.xml

<dependencies>
    <!-- other dependencies are there -->
    <dependency>
        <groupId>com.github.aistomin</groupId>
        <artifactId>jenkins-sdk</artifactId>
        <version>0.2.1</version>
    </dependency>
    <!-- other dependencies are there -->
</dependencies>

Quick start

Using classes from com.github.aistomin.jenkins and com.github.aistomin.jenkins.real you can manipulate with existing Jenkins installation. For example, reading builds information:

public class Main {
    public static void main(String[] args) throws Exception {
        Jenkins jenkins = new RealJenkins(
            "<YOUR JENKINS URL>",
            new UsernamePasswordCredentials("<USERNAME>", "<PASSWORD>")
        );
        Job job = jenkins.jobs().findByName("<JOB NAME>").next();
        System.out.println("----------------- BUILDS -----------------");
        final Iterator<Build> iterator = job.builds().iterator();
        while (iterator.hasNext()) {
            Build build =  iterator.next();
            System.out.println(build.number());
        }
        System.out.println("----------------------------------------");
    }
}

More details and code examples you may find in documentation or examples project.

Every API object contains some methods for getting information. Also it has .xml() method. This method allows you to get plain object's XML which allows you to decorate our objects in a way you like.

We provide a number of stub classes which are going to help you with testing your code which is using our project. Using classes from com.github.aistomin.jenkins.fake you can create stubs/fakes of Jenkins installation.

Have you found a bug?

We've tested our code using Jenkins ver. 1.642.2. We're not robots and bugs are possible :) Don't hesitate to create and issue. It will help to make our project better. Thanks in advance.

How to contribute?

Do you want to help us with this project? Please: fork the repository, make changes, submit a pull request. We promise to review your changes same day and apply to the master branch, if they look correct.

Please run Maven (3.1 or higher!) build before submitting a pull request:

$ mvn clean install -Pqulice

Be aware: unfortunately our Jenkins instance for integrations tests is not perfect. Sometimes it's slow, sometimes it's even not available. We're trying to do our best to solve this problem, but for now we haven't got success with that :( Thanks in advance for your help.

Jenkins Instance for Integration tests

We have running instance at https://cisdk-istomin.rhcloud.com Unfortunately, sometimes this instance goes to "Idle" status and needs to be restarted. But, at least, we have something to test with. Feel free to create an issue if Jenkins is not available.

Versions

Version
0.2.1
0.2
0.1
0.0.2
0.0.1