Skip to content

Simulating Travis

When using Travis, it is often useful to be able to debug when system environments are causing issues. As Travis can not be SSH'd in to or set in debug mode without a paid plan we need to get creative for our open source projects.

Setting up the environment

You can use the following two scripts to setup your local Travis environment.

Note

It's important to point out here that this isn't Travis, it's only a simulation of the same environment your scripts will be running in on Travis (which is all that we need really).

TODO: add gist for run.bash

TODO: add gist for travis_run.bash

run.bash

To use run.bash you need to know the following: * The docker image you're going to run inside * Your github repo * The git branch you want to test

To determine the docker image you need we need to look at the build log.

At the top of the build log there is information about the Docker image used. This is displayed under worker_info which is displayed on the right of the log output.

Look for this line int the 'Worker information' section of the output: instance: f7fe1ad travisci/ci-garnet:packer-1512502276-986baf0 (via amqp)

The part we are interested in is travisci/ci-garnet:packer-1512502276-986baf0 This is the Docker image we need to use.

Getting the image to use

travis_run.bash

First, we need to extract the steps used by Travis when it is running a build,

Running the container

Now that we know what image to use, we can build this locally.