Skip to content
Java client, built on top of jclouds, for working with Jenkins REST API
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Moved contributing.md file. Apr 15, 2018
gradle Bump gradle to 4.10.3 Mar 18, 2019
src add LiveTest and MockTest Mar 14, 2019
.editorconfig
.gitattributes Add gitattributes. Apr 15, 2018
.gitignore
.travis.yml Add travis integration. Apr 15, 2018
CODE_OF_CONDUCT.md
LICENSE.txt init jenkins-rest project. Apr 13, 2016
README.md Update README.md Sep 13, 2018
RELEASE_NOTES.md Prepare for next development iteration. Mar 18, 2019
build.gradle Bump jclouds to 2.1.2 Mar 18, 2019
gradle.properties
gradlew init jenkins-rest project. Apr 13, 2016
gradlew.bat
settings.gradle init jenkins-rest project. Apr 13, 2016

README.md

Build Status codecov Download Stack Overflow

jenkins-rest

Java client, built on top of jclouds, for working with Jenkins REST API.

Setup

Client's can be built like so:

JenkinsClient client = JenkinsClient.builder()
.endPoint("http://127.0.0.1:8080") // Optional. Defaults to http://127.0.0.1:8080
.credentials("admin:password") // Optional.
.build();

SystemInfo systemInfo = client.api().systemApi().systemInfo();
assertTrue(systemInfo.jenkinsVersion().equals("1.642.4"));

Latest release

Can be found in jcenter like so:

<dependency>
  <groupId>com.cdancy</groupId>
  <artifactId>jenkins-rest</artifactId>
  <version>X.Y.Z</version>
  <classifier>sources|tests|javadoc|all</classifier> (Optional)
</dependency>

Documentation

Property based setup

Client's do NOT need supply the endPoint or credentials as part of instantiating the JenkinsClient object. Instead one can supply them through system properties, environment variables, or a combination of the 2. System properties will be searched first and if not found we will attempt to query the environment.

Setting the endpoint can be done with any of the following (searched in order):

  • jenkins.rest.endpoint
  • jenkinsRestEndpoint
  • JENKINS_REST_ENDPOINT

Setting the credentials can be done with any of the following (searched in order):

  • jenkins.rest.credentials
  • jenkinsRestCredentials
  • JENKINS_REST_CREDENTIALS

Credentials

jenkins-rest credentials can take 1 of 2 forms:

  • Colon delimited username and password: admin:password
  • Base64 encoded username and password: YWRtaW46cGFzc3dvcmQ=

Examples

The mock and live tests provide many examples that you can use in your own code.

Components

  • jclouds - used as the backend for communicating with Jenkins REST API
  • AutoValue - used to create immutable value types both to and from the jenkins program

Testing

Running mock tests can be done like so:

./gradlew clean build mockTest

Running integration tests can be done like so (requires existing jenkins instance):

./gradlew clean build integTest 

Additional Resources

You can’t perform that action at this time.