## Debugging Travis CI locally using Docker This assumes you've got docker-machine installed, running, and can do `docker run` ### 1. Get a debug instance running ``` docker run --name travis-debug -dit quay.io/travisci/travis-ruby /sbin/init docker exec -it travis-debug bash -l ``` ### 2. As `root`: Install any packages you need via `apt-get` ### 3. `su - travis` ### 4. Install travis-build ``` rvm install 2.2.5 rvm use 2.2.5 gem install travis travis version # generates ~/.travis cd builds git clone https://github.com/travis-ci/travis-build.git cd travis-build ln -s `pwd` ~/.travis/travis-build bundle install ``` ### 5. Install your code and generate the ci.sh script ``` github_user_name=YOUR_GITHUB_USER_NAME github_repo=YOUR_GITHUB_REPO cd ~/builds mkdir $github_user_name cd $github_user_name git clone https://github.com/${github_user_name}/${github_repo}.git cd $github_repo # change to the branch or commit you want to investigate travis compile > ~/builds/ci.sh cd ~/builds # You most likely will need to edit ci.sh as it ignores matrix and env bash ci.sh ``` ### Sources 1. [Travis CI Docs: Running a container-based Docker Image](https://docs.travis-ci.com/user/common-build-problems/#Running-a-Container-Based-Docker-Image-Locally) 2. [StackOverflow: How to reproduce a Travis CI build environment for debugging](http://stackoverflow.com/questions/29753560/how-to-reproduce-a-travis-ci-build-environment-for-debugging)