CI as Code Part III: Dynamic Jenkins-Swarm Example

Introduction

This article continues on from the previous two posts outlining a method of provisioning Jenkins instances on demand programatically using docker-compose.

In this post we take this one step further by demonstrating how a Docker container can dynamically add itself as a client to the Jenkins server.

Overview

This updated diagram shows the architecture at part III

jenkins_stateless_v3 (3)

The ‘Jenkins-Swarm Docker Slave’ is new to this example. It is similar to the ‘Jenkins SSH Slave’ except that it connects itself to the Jenkins server as a slave running as a Docker container. Using this as a template you can dynamically add multiple clients to the Jenkins server under the ‘swarm’ tag.

Note: Do not confuse ‘Jenkins Swarm’ with ‘Docker Swarm’.
They are two different things: Jenkins Swarm allows clients to
dynamically attach themselves to a server and run jobs, while
Docker Swarm is a clustering solution for Docker servers.

New plugins

In addition, these new plugins have been added:

swarm – allow dynamic jenkins clients to be added via port 50000
backup – backs up configuration on demand (basic configuration set up by scripts)
jenkinslint – gives advice on your jenkins setup
build-timeout – allow a build timeout
docker-build-publish – build and publish Docker projects to the Docker Hub
greenballs – green balls for success, not blue!

Code

This is now baked into v3.0 of the git repo.

Video

Skip to the end for a demo of a simple job running on a swarm node.

Currently co-authoring a book on Docker:

Get 39% off with the code 39miell

dip

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to CI as Code Part III: Dynamic Jenkins-Swarm Example

  1. Pingback: dynamic jenkins | simple note

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s