I am very excited to announce that we have recently released 1.0 version of Remoting Kafka Plugin under Jenkins Plugin. You can check the CHANGELOG to see the features included in this release.

About me

My name is Pham Vu Tuan, I am a final year undergraduate student from Singapore. This is the first time I participate in Google Summer of Code and contribute to an open-source organization.

Mentors

I have GSoC mentors who help me in this project Oleg Nenashev and Supun Wanniarachchi. Besides that, I also receive great support from developers in remoting project Devin Nusbaum and Jeff Thompson.

Overview

Current versions of Jenkins Remoting are based on the TCP protocol. If it fails, the agent connection and the build fails as well. There are also issues with traffic prioritization and multi-agent communications, which impact Jenkins stability and scalability.

This project aims to develop a plugin in order to add support of a popular message queue/bus technology (Kafka) as a fault-tolerant communication layer in Jenkins.

Benefits to the community

  • Provide a new method to connect agent to master using Kafka besides existing methods such as JNLP or SSH Build Agents plugin.

  • Help to resolve the existing issues with the TCP protocol between master and agent communication in Jenkins.

  • Help to resolve traffic prioritization and multi-agent communications issue in Jenkins.

Why Kafka?

When planning for this project, we want to use traditional message queue system such as ActiveMQ or RabbitMQ. However, after some discussion, we decided to have a try with Kafka with more suitable features with this project:

  • Kafka itself is not a queue like ActiveMQ or RabbitMQ, it is a distributed, replicated commit log. This helps to remove message delivery complexity we have in traditional queue system.

  • We need to support data streaming as a requirement, and Kafka is good at this aspect, which RabbitMQ is lack of.

  • Kafka is said to have a better scalability and good support from the development community.

Architecture Overview

The project consists of multiple components:

  • Kafka Client Library - new command transport implementation, producer and consumer client logic.

  • Remoting Kafka Plugin - plugin implementation with KafkaGlobalConfiguration, KafkaComputerLauncher and KafkaSecretManager.

  • Remoting Kafka Agent - A custom JAR agent with remoting JAR packaged together with a custom Engine implementation to setup a communication channel with Kafka. The agent is also packaged as a Docker image in DockerHub.

  • All the components are packaged together with Docker Compose.

The below diagram is the overview of the current architecture: remoting kafka architecture

With this design, master is not communicating with agent using direct TCP communication anymore, all the communication commands are transfered with Kafka.

Features

The project is now under the third coding phase and we have some features available in 1.0 release.

1. Kafka Global Configuration with support of credentials plugin to store secrets.

remoting kafka configuration

2. Launch agent with Kafka Launcher.

launch agent kafka

3. Launch agent from CLI using agent JAR with secret provided to ensure security.

agent cli

4. Run jobs, pipeline using Kafka agent.

demo jobs

5. Kafka communication between master and agent.

kafka commands

Remoting operations are being executed over Kafka. In the log you may see:

  • Command execution (SlaveInstallerFactoryImpl.isWindows())

  • Classloading (Classloader.fetch())

  • Log streaming (Pipe.chunk())

How to run demo

We have setup a ready-to-fly demo for this plugin. You can try to run a demo of the plugin by following this instruction. Features in the demo:

  • Docker Compose starts preconfigured Master and agent instance, they connect automatically using Kafka launcher.

  • Kafka is secured and encrypted with SSL.

  • There few demo jobs in the instance so that a user can launch a job on the agent.

  • Kakfa Manager supported in localhost:9000 to support monitoring of Kafka cluster.

Phase 2 Presentation Slides

Phase 2 Presentation Video

About the Author
Pham Vu Tuan

Pham Vu Tuan is a developer from Singapore. He starts contributing to Jenkins from Google Summer of Code 2018 for Jenkins Remoting over Message Bus/Queue