Table of contents

Test & build a project on Jenkins CI

Application tests run in a continuous integration (CI) environment.

Read here about the CI infrastructure.

Setting up

1. Create the job in Jenkins

You need to add your repo to the govuk_ci::master::pipeline_jobs in govuk-puppet. This will create the job in Jenkins.

2. Add a Jenkinsfile

Your repo needs to contain a Jenkinsfile in the root which has details of how the application is built. In most cases the Jenkinsfile will need to run the tests for your project. For applications the build process includes creating a release tag. For gems the build process includes releasing the packaged gem to

The following Jenkinsfile should be sufficient for most projects:

#!/usr/bin/env groovy

node {
  def govuk = load '/var/lib/jenkins/groovy_scripts/govuk_jenkinslib.groovy'

Read the documentation for this in alphagov/govuk-puppet

3. Trigger builds from GitHub

Builds are triggered using a GitHub “service”. From a project’s GitHub settings, add the “Jenkins (GitHub plugin)” service to point to:

See content-store’s configuration for an example.

4. Branch indexing

Once your Jenkinsfile is on a branch, you can go to your job in new Jenkins and run “Branch Indexing” from the menu. This should trigger a build of all branches with a Jenkinsfile, which should be your new branch. Any open branches need to be rebased after you’ve merged your Jenkinsfile into master.

5. Set up schema testing

Many GOV.UK applications test against the content schemas.

To test your application for each PR on govuk-content-schemas, add it to the govuk-content-schemas Jenkinsfile.

This page is owned by #2ndline and needs to be reviewed