Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Ruby app that makes your Jenkins CI automatically run tests on Github pull requests and updates their commit status.
Ruby

README.rdoc

Introduction

Jently is a Ruby app that makes it possible for Jenkins to run tests on open pull requests on Github. Jently itself acts as a mediator between Jenkins and Github. It talks to Github to get an open pull request, creates a testing branch and then instructs Jenkins to run tests on this particular branch. After Jenkins has finished testing the branch, Jently collects the result and updates the status of the relevant pull request commit.

Features

  • Jently tests the merged version of a pull request rather than just the feature branch. It takes into account all changes made upstream after a feature branch was created.

  • Jently automatically re-runs tests whenever new commits are added to either the pull request itself or the branch that the pull request needs to be merged into.

  • Jently uses the Github Commit Status API to update the status of the last commit of a pull request. Whenever possible, a status update contains a link to the Jenkins job that was run to ascertain the correct status.

Getting Started

There are 5 small steps involved in getting Jently up and running. These steps assume you have a recent version of Ruby installed and have sufficient access to your Jenkins CI so as to add builds.

Modifying your Jenkins CI

You will need to setup a parameterized Jenkins build for testing pull requests. Jently will instruct Jenkins to use this build for running tests on an open pull request. You can tell Jently about this build by modifying its configuration file. We will look at this configuration file in a later step, but for now let's focus on setting up the parameterized build.

On the Configure build screen of your job, you'll want to check the 'This build is parameterized' checkbox and add a 'branch', 'repository', and 'id' parameter. The order of the parameters is important. It should look like this:

Further down on the Configure build screen you can specify your Source Code Management settings. Make sure that your branch specifier is set to '$branch' and that your repository url is set to '$repository'. Furthermore, you have to specify the Refspec for pull-requests in “Advanced…” settings:

+refs/pull/*:refs/remotes/origin/pr/*

It should look like this:

Downloading Jently

You'll need to clone the Jently repository to your hard drive in order to get started. You can do this by running:

git clone git@github.com:vaneyckt/Jently.git

Modifying the configuration file

A configuration file can be found in the /config directory. There are a few configuration details that you will need to specify before running Jently. The comments in the file should hopefully make it easy to get everything set up right.

Installing the software

Manual installation

Jently uses bundler to install the Ruby gems it requires. You can install bundler by running:

gem install bundler

You can now use bundler to install the required gems by navigating into the Jently folder and running:

bundle install
Chef

A cookbook exists for automating the installation and configuration of Jently via Chef.

github.com/paydici/jently-cookbook

Running Jently

Navigate into the Jently folder and run:

bundle exec rake jently:start

This command will start Jently as a daemon process in the background. If this is your first run, Jently will start by cloning the specified repository into the /repositories directory, and will also create a .yaml file in the /db directory to help keep track of pull requests.

Common problems

  • ensure that Jently has read and write permissions for the /db folder and its contents.

  • certain older versions of Ruby have been observed to suffer the occasional hiccup. Ruby 2.0.0-p195 will work perfectly.

Something went wrong with that request. Please try again.