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

This process is completely scriptable but I am going to detail the steps required to simulate a Travis build inside Docker.

First, we need to extract the steps used by Travis when it is running a build, as well as the Docker image it is running on. To do this, we need to look at the build log where the worker information is detailed.

Getting the image to use

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: 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.

Running the container

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