Skip to main content

Jenkins

Jenkins Ci integration is fairly straightforward, and we recommend using the Docker Xvfb runner. That way we avoid setting up Xvfb for headless runs, which can be quite complex.

Start by copying the boilerplate script and create a free-style job according to the instructions given

  1. Click "New Item" in the Jenkins main view
  2. Choose "Freestyle project"
  3. Add build step -> Execute Shell
  4. Copy the below code into the shell
  5. Add a Post-build action -> Add Cucumber reports
  6. The job is ready to run!

Below is a sample of code generated. Note that most of these settings will vary depending on your particular project settings and selected test to run.

BASE=http://staging-be.boozang.com
TOKEN=my-secret-token
ENV=4
PROJECT=5e3f275e64f84941a326d4d8
BRANCH=jira61
SELF=0
TEST=m72/t10
GROUP=
SCOPE=
PARAMETER=
WORKERS=1

echo Running $workers processes for test: $test

echo Setting up slaves
counter=1
while [ $counter -lt ${WORKERS} ]
do
((counter++))
WORKER_URL="${BASE}/extension?parameter=${PARAMETER}&token=${TOKEN}${PROJECT}group=${GROUP}&scope=${SCOPE}&env=${ENV}&key=${counter}&self=${SELF}#${PROJECT}/${BRANCH}"
nohup docker run --rm -v "$(pwd):/var/boozang/" --name=bzworker${counter} styrman/boozang-runner "${WORKER_URL}" > out_${counter}.log &
done

echo All slaves done. Starting master job.

MASTER_URL="${BASE}/extension?parameter=${PARAMETER}&token=${TOKEN}${PROJECT}&group=${GROUP}&scope=${SCOPE}&env=${ENV}&key=1&self=${SELF}#${PROJECT}/${BRANCH}/${TEST}/run"
docker run --rm -v "$(pwd):/var/boozang/" --name=bzworker1 styrman/boozang-runner "${MASTER_URL}"

It's often a good idea to add parameters to the job, for instance "module_id/test_id" and "number_of_workers".

In order to see an example setup using an upstream pipeline, check out this post on our user forum: https://boozang.com/forum/topic/jenkins-config-for-distributed-runs/