DotCI - a plugin providing a new way to Build with Jenkins, Docker and Github.

A little over a week ago the DotCi plugin was released, thanks to Groupon.

This plugin is quite expansive - and “opinionated” - it allows you to use Jenkins in a tightly integrated way with GitHub, using Docker to run your builds isolated with whatever dependencies your project needs.

Lets take a look:

Firstly, DotCI will discover your Github repos (via OAuth) - you then pick one to use for your new Job (A job is connected to your Github repo - including pull requests). It will be triggered by Github when you make a change, and put comments on your commit and all that good stuff.

But what is interesting to me - is how you define a build, here is a .ci.yml file in the root of a project:








image: ubuntu



   language: ruby






      - google/mysql






    run: echo hello world


This says “build me a ruby project, on an ubuntu image, that needs a mysql server running”. With an optional build instruction (a script - the language usually specifies a default for that language). That is all you need. This lives along with your project. It can even autodetect what language your project is in.




How it works 

Detail:  The environment section specifies what language to use (java, ruby, golang, clojure, nodejs are supported this way at the moment). This tells it how to build that type of project.

There is also the “image” - this tells it the Docker image to pull down and run. In my sample - I left that out, and put a Dockerfile in the root of my project. Jenkins via DotCI will pick that up and then build an environment using that Dockerfile, and THEN run the build inside it (first time will download stuff on the slave, later will be near instant). So you can either point to an existing image - or you can put a Dockerfile with specific dependencies needed for your build environment.

The services section: this specifies that a google/mysql image will be obtained, started, and then linked in to allow the test to run. You can depend on other services (or none).

Note you can even leave out a .ci.yml file - and let it guess (you can include a Dockerfile for details about the required build environment).

Of course - everything is torn down at the end when the build is successful - in terms of Docker containers.





Wait - there’s more! 

You can even use this without docker if you like.

You can run different types of tests concurrently:





    unit: rake spec
    integration: rake integration

(unit and integration tests at the same time)

You can use plugins:





    <% if( DOTCI_BRANCH == 'master'){ %>
    - artifacts: 'packages/**/*.war'
    - checkstyle

Run permutations of tests for different versions:




     language: ruby
          - 1.8.7
          - 1.9.3

The docs are fairly extensive, including notes on setting up.

Note at this time, DotCI will need to be run on a public facing URL so github can do webhook events to trigger builds - or at least visible to your Github Enterprise installation.

MongoDB is also a dependency.

This is an interesting development, and one to watch. Read more here.












Blog Categories: 

Add new comment