Skip to content

Lab 3 (Wed): Travis CI

Raymie Stata edited this page Jan 29, 2018 · 6 revisions

Lab instructions

In this lab we will configure TravisCI and watch it do builds and deploys.

  1. Configure Travis as described in this document.

  2. Make sure your Limbo bot is not running in ECS by typing docker-compose run ecs stop (or just dcr ecs stop if you've defined the dcr alias).

  3. In your git fork of Limbo, make a branch off of master called lab3. Push this branch to GitHub and check that TravisCI can successfully build and test it. As this build illustrates, our Travis configuration will only build and test Limbo, it will not deploy it. However, when Travis detects a change when your Slackbot is running, it will push the change all the way to ECS for you. Let's see that in action.

  4. On your laptop, start Limbo in ECS by typing docker-compose run ecs start.

  5. On the build page for the previous build, hit the "Rebuild" button on the left, near the top of the page. It's circled in red in this diagram:

To determine if a build successfully deployed your bot, go to about the 6th line from the bottom of the build's log, and look for a line that reads ECS Service has reached a stable state. See, for example, this build), which did succeed in its deployment. If, instead, you see the message Service not running, so not pushing an update, this means the service wasn't already running when Travis tried to do a push (our Travis deployment script will not start a Limbo chatbot in ECS, it will only update one if it's already running). To get your bot running, you need to manually type docker-compose run ecs start from your laptop.

To reduce clutter, you'll want to delete these branches from both your local and GitHub repositories after you've been successful.

Now that you have a continuous integration and deployment system in place, you can continue working on your Hackday project with even more ease.

Supplemental Git instructions

If you are not familiar with Git, the following instructions may help you get through the above steps more easily.

Get to clean master

The lab assumes you're starting on a master branch that hasn't been modified. (If you know what you doing with Git, you don't need to follow this assumption.)

To determine your current branch and it's state, make sure you are inside the directory containing your local clone of your fork of Limbo, and type git status. You should see something like the following:

Admins-MacBook-Pro-4:rstata-verticloud-limbo raymie$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Note that it says I'm on branch master which is up to date with origin. If you're not on master and/or you are not up to date, then let an instructor know.

Make the lab3 branch and push it to GitHub

Once you're in a clean master branch, use Git's checkout command to both create the lab3 branch and switch to it:

Admins-MacBook-Pro-4:rstata-verticloud-limbo raymie$ git checkout -b lab3
Switched to a new branch 'lab3'

To trigger TravisCI to build and test (but not deploy) this branch, use Git's push command:

Admins-MacBook-Pro-4:rstata-verticloud-limbo raymie$ git push origin lab3
Total 0 (delta 0), reused 0 (delta 0)
To github-rstata-verticloud:rstata-verticloud/limbo.git
 * [new branch]      lab3 -> lab3

If Travis is configured correctly, then this will trigger a build for the lab3 branch.