All Projects → yaravind → kafka-connect-jenkins

yaravind / kafka-connect-jenkins

Licence: Apache-2.0 license
Kafka Connect Connector for Jenkins Open Source Continuous Integration Tool

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to kafka-connect-jenkins

kafka-connect-cosmosdb
Kafka Connect connectors for Azure Cosmos DB
Stars: ✭ 28 (-3.45%)
Mutual labels:  kafka-connect, kafka-connector
kafka-connect-iot-mqtt-connector-example
Internet of Things Integration Example => Apache Kafka + Kafka Connect + MQTT Connector + Sensor Data
Stars: ✭ 170 (+486.21%)
Mutual labels:  kafka-connect, kafka-connector
kafka-connect-fs
Kafka Connect FileSystem Connector
Stars: ✭ 107 (+268.97%)
Mutual labels:  kafka-connect, kafka-connector
event-recommender-festa
[SI -> 오늘회, 펫프렌드 이직, 연봉 35% 상승] 내 주변지역의 이벤트와 행사를 추천해주는 서비스
Stars: ✭ 64 (+120.69%)
Mutual labels:  jenkins
up
UP - Ultimate Provisioner CLI
Stars: ✭ 43 (+48.28%)
Mutual labels:  jenkins
jenkins-stack-docker
Docker-compose version of jenkins-stack-kubernetes
Stars: ✭ 135 (+365.52%)
Mutual labels:  jenkins
vacomall
☀️☀️ 基于 dubbo 实现的分布式电商平台。
Stars: ✭ 42 (+44.83%)
Mutual labels:  jenkins
cjp-demo-environment
CloudBees CI Demo based on Docker Compose
Stars: ✭ 23 (-20.69%)
Mutual labels:  jenkins
windows-slave-installer-module
Windows Agent Installer module for Jenkins
Stars: ✭ 12 (-58.62%)
Mutual labels:  jenkins
learn-ansible-and-jenkins-in-30-days
Ansible + Jenkins in 30 days tutorial.
Stars: ✭ 35 (+20.69%)
Mutual labels:  jenkins
devops-jenkins-box-template
Bootstrap template to provision your agency own Jenkins server
Stars: ✭ 22 (-24.14%)
Mutual labels:  jenkins
Containerization-Automation
Study and Use of Containers and Automation Tools
Stars: ✭ 45 (+55.17%)
Mutual labels:  jenkins
caesar
持续集成
Stars: ✭ 40 (+37.93%)
Mutual labels:  jenkins
drone-jenkins
Drone plugin for trigger Jenkins jobs.
Stars: ✭ 35 (+20.69%)
Mutual labels:  jenkins
MongoDb-Sink-Connector
Kafka MongoDb sink connector
Stars: ✭ 19 (-34.48%)
Mutual labels:  kafka-connect
kafka-connect-http
Kafka Connect connector that enables Change Data Capture from JSON/HTTP APIs into Kafka.
Stars: ✭ 81 (+179.31%)
Mutual labels:  kafka-connect
jira-trigger-plugin
Triggers a build when a certain condition is matched in JIRA
Stars: ✭ 112 (+286.21%)
Mutual labels:  jenkins
Hands-On-Serverless-Applications-with-Go
Hands-On Serverless Applications with Go, published by Packt.
Stars: ✭ 92 (+217.24%)
Mutual labels:  jenkins
config-file-provider-plugin
Jenkins plugin to administrate the maven settings (settings.xml).
Stars: ✭ 43 (+48.28%)
Mutual labels:  jenkins
jenkins-client-java
Java实现的对Jenkins操作
Stars: ✭ 28 (-3.45%)
Mutual labels:  jenkins

Kafka Connect Jenkins

Build Status Coverage Status Codacy Badge Stories in Ready Join the chat at https://gitter.im/yaravind/kafka-connect-jenkins

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.

Details

+--------+   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

Example

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

Resource Details
Get list of all Jobs:
https://builds.apache.org/api/json

GET lastBuild of Abdera-trunk Job:
https://builds.apache.org/job/Abdera-trunk/api/json

GET BuildDetails for build 2546 of job Abdera-trunk:
https://builds.apache.org/job/Abdera-trunk/2546/api/json

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": "https://builds.apache.org/job/Abdera-trunk/2546/",
    "builtOn": "jenkins-ubuntu-1404-4gb-c51",
    "changeSet": {
        "items": [
            {
                "affectedPaths": [
                    "client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java"
                ],
                "author": {
                    "absoluteUrl": "https://builds.apache.org/user/veithen",
                    "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/MultipartRelatedRequestEntityTest.java"
                    }
                ],
                "revision": 1697770,
                "user": "veithen"
            }
        ],
        "kind": "svn",
        "revisions": [
            {
                "module": "https://svn.apache.org/repos/asf/abdera/java/trunk",
                "revision": 1697770
            }
        ]
    },
    "culprits": [
        {
            "absoluteUrl": "https://builds.apache.org/user/veithen",
            "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.

Configurations

Property Description Required? Default value
connector.class Class implementing source connector for Jenkins. Yes org.aravind.oss.kafka.connect.
jenkins.JenkinsSourceConnector
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
jenkins.read.timeoutInMillis 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
jenkins.jobs.resource.path 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 confluent-3.0.0-2.11.zip
  3. Move to Confluent home directory cd confluent-3.0.0
  4. Start Zookeeper ./bin/zookeeper-server-start etc/kafka/zookeeper.properties
  5. Start Kafka Broker ./bin/kafka-server-start ./etc/kafka/server.properties
  6. Clone https://github.com/yaravind/kafka-connect-jenkins.git
  7. Run mvn clean install
  8. Update the jenkins.base.url property in connect-jenkins-source.properties 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 connect-standalone.properties connect-jenkins-source.properties

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

Logging

You can enable the logging for the connector by adding log4j.logger.org.aravind.oss=DEBUG (TRACE) to connect-log4j.properties. Following table can help you with finer level of logging.

Intent Configuration (DEBUG or TRACE)
Enable logging for Jenkins Source Connector only log4j.logger.org.aravind.oss.kafka.connect.jenkins.JenkinsSourceConnector=DEBUG
log4j.logger.org.aravind.oss.kafka.connect.lib.TaskConfigBuilder=DEBUG
Enable logging for Jenkins Source Task only log4j.logger.org.aravind.oss.kafka.connect.jenkins.JenkinsSourceTask=DEBUG
log4j.logger.org.aravind.oss.kafka.connect.jenkins.ReadYourWritesOffsetStorageAdapter=ERROR
log4j.logger.org.aravind.oss.kafka.connect.lib.Partitions=DEBUG
Enable logging for communication with Jenkins API only log4j.logger.org.aravind.oss.jenkins.JenkinsClient=TRACE

Monitoring

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

Limitations

  • 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.

Dependencies

Contribute

License

The project is licensed under the Apache 2 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].