Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Kafka Connect Jenkins

Build Status Coverage Status Codacy Badge Stories in Ready Join the chat at

Kafka Connect Connector for Jenkins Open Source Continuous Integration Tool.

What is it?

kafka-connect-jenkins is a Kafka Connector for loading data from Jenkins Open Source Continuous Integration Tool.


+--------+   0..*   +-------+  0..*   +-------+   1      +--------------+
| Server +--------> |  Job  +-------> | Build +--------> | BuildDetails |
+--------+          +-------+         +-------+          +--------------+

The following comparison might give you more insight.

Example Input Partitions (Logical) Records Offsets/Position
Set of files each File each Line line Number within a file
Database instance each Table each Row primary id + timestamp
Jenkins Server each Job BuildDetails of each Build (lastBuild) build number of lastBuild


We will use Apache Jenkins REST API to demonstrate an example.

Resource Details
Get list of all Jobs:

GET lastBuild of Abdera-trunk Job:

GET BuildDetails for build 2546 of job Abdera-trunk:

What gets published to the topic?

The BuildDetails is treated as an event and is persisted to the topic in JSON format. Below is the content of a sample event

    "actions": [
            "causes": [
                    "shortDescription": "Started by an SCM change"
            "failCount": 0,
            "skipCount": 1,
            "totalCount": 491,
            "urlName": "testReport"
    "artifacts": [],
    "building": false,
    "description": null,
    "displayName": "#2546",
    "duration": 480582,
    "estimatedDuration": 457794,
    "executor": null,
    "fullDisplayName": "Abdera-trunk #2546",
    "id": "2015-08-25_22-08-43",
    "keepLog": false,
    "number": 2546,
    "queueId": -1,
    "result": "SUCCESS",
    "timestamp": 1440540523000,
    "url": "",
    "builtOn": "jenkins-ubuntu-1404-4gb-c51",
    "changeSet": {
        "items": [
                "affectedPaths": [
                "author": {
                    "absoluteUrl": "",
                    "fullName": "veithen"
                "commitId": "1697770",
                "timestamp": 1440537458260,
                "date": "2015-08-25T21:17:38.260515Z",
                "msg": "Use factory to create FOMEntry instance.",
                "paths": [
                        "editType": "edit",
                        "file": "/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/"
                "revision": 1697770,
                "user": "veithen"
        "kind": "svn",
        "revisions": [
                "module": "",
                "revision": 1697770
    "culprits": [
            "absoluteUrl": "",
            "fullName": "veithen"
    "mavenArtifacts": {},
    "mavenVersionUsed": "3.0.4"

What can I do with it?

In an organization, there can be one or more CI/CD servers (usually Jenkins) managing the day to day builds and deployments of various components or services. We usually see each business unit (or vertical) managing their own Jenkins instance. Any such organization can benefit from treating build events same like any other transactional or master data. Here are some use-cases that these build events can enable.


Property Description Required? Default value
connector.class Class implementing source connector for Jenkins. Yes org.aravind.oss.kafka.connect.
tasks.max Yes 1
jenkins.base.url The URL where jenkins server is running Yes None
jenkins.pollIntervalInMillis Frequency (in milliseconds) to poll for new build events in Jenkins Yes 1 minute
jenkins.username If your Jenkins is secured, you can provide the username with this property No None
jenkins.password.or.api.token If your Jenkins is secured, you can provide the password or api token with this property No None
jenkins.connection.timeoutInMillis Connection timeout in milliseconds. This denotes the time elapsed before the connection established or Server responded to connection request. Yes 500 Response read timeout in milliseconds. After establishing the connection, the client socket waits for response after sending the request. This is the elapsed time since the client has sent request to the server before server responds. Yes 3000 Relative path to REST API Yes /api/json
topic Name of the topic where the Build status records are written to. Make sure you explicitly create this topic using tools provided by Kafka. Do not rely on the default topic creation functionality in PRODUCTION. Yes jenkins.connector.topic

How to use it?

Standalone mode

While testing, you might want to run the connector in standalone mode. Follow these steps

  1. Download Confluent platform 3.0.0 ZIP file from here
  2. Unzip it unzip
  3. Move to Confluent home directory cd confluent-3.0.0
  4. Start Zookeeper ./bin/zookeeper-server-start etc/kafka/
  5. Start Kafka Broker ./bin/kafka-server-start ./etc/kafka/
  6. Clone
  7. Run mvn clean install
  8. Update the jenkins.base.url property in file with your jenkins base url
  9. Add Jenkins connector to classpath and start the connector in standalone mode CLASSPATH=./target/kafka-connect-jenkins-0.5.0-SNAPSHOT-package/share/java/kafka-connect-jenkins/* <<path-to-confluent-home-directory>>/bin/connect-standalone

If you need to proxy to connect to Jenkins then append these to the above command -Dhttp.proxyHost=... -Dhttp.proxyPort=... -Dhttps.proxyHost=... -Dhttps.proxyPort=...


You can enable the logging for the connector by adding (TRACE) to Following table can help you with finer level of logging.

Intent Configuration (DEBUG or TRACE)
Enable logging for Jenkins Source Connector only
Enable logging for Jenkins Source Task only
Enable logging for communication with Jenkins API only


Replace localhost with your server and 8083 with rest.port configuration value.

REST API Details
http://localhost:8083/ Kafka Connector
http://localhost:8083/connectors/ All deployed connectors
http://localhost:8083/connectors/kafka-jenkins-source-connector/ JenkinsSourceConnector
http://localhost:8083/connectors/kafka-jenkins-source-connector/config JenkinsSourceConnector config
http://localhost:8083/connectors/kafka-jenkins-source-connector/tasks JenkinsSourceConnector tasks


  • Saves only the most recent build (lastBuild) know after configured jenkins.pollIntervalInMillis. i.e. if a Job has been built multiple times within the poll intervals, it isn't accounted for.
  • Requires JDK 8 to run the connector. Making JDK 7 compatible version isn't a big deal. Raise an issue if you need one.




The project is licensed under the Apache 2 license.


Kafka Connect Connector for Jenkins Open Source Continuous Integration Tool





No releases published


No packages published
You can’t perform that action at this time.