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.
-
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.
-
Jently has the ablility to inly run tests when a specific comment is made in Github on open pull requests.
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.
Jently requires several Ruby gems to be installed. You can install all of these in one go by running:
gem install jently
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’. It should look like this:
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
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.
By default this Jently version only will run if a specific comment is left in open pull requests. If you would like Jently to test each time a pull request is created or updated you need to do the following.
-
open jently.rb and comment out line 12.
-
you then should uncomment line 15.
Navigate into the Jently folder and run:
ruby jently.rb
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.