Travis CI

Travis CI Partner Ruby

Deploy

This git repository helps you easily integrate Travis CI into your OpenShift apps.

Once you've created the quickstart, you'll need to create a Travis CI account and add your authorization information to your Git repository. Making code changes will require you to set a public SSH key, and then to clone your new application Git repository onto your local machine. See the Getting Started page for more steps in this flow.

Travis CI integration with OpenShift

This is a sample OpenShift application that illustrates integration with open source continuous integration system, Travis CI.

Add Github remote

rhc app create creates a local working copy in myapp.

We will work in that copy: cd myapp

This copy has a git remote pointing to your OpenShift gear, so it is a good idea to rename it before going further:

git remote rename origin openshift

Next, create a new repository on Github. The name can be anything, but for the purpose of illustration, we call it myapp.

Finally, add a remote pointing to Github:

git remote add origin https://github.com/<USER>/myapp.git

And push code:

git push -u origin master

Enable Travis on the Github repo

Next, visit Travis profile page and locate your new application myapp and enable Travis integration.

If you do not see it, press "Sync now" button near the top of the page.

Edit .travis.yml

This quickstart has a near-empty .travis.yml (more on this below). After running bundle install to install dependencies, run travis to populate the deploy section:

$ travis setup openshift
OpenShift user: user@example.com
OpenShift password: ************
OpenShift application name: |myapp|
OpenShift domain: openshiftdomain
Deploy only from <USER>/myapp? |yes| 
Encrypt password? |yes| 

Note on Build Script

The default build script for a Ruby application on Travis is rake. This is not applicable for this simple application, so we override this with a simple true script that succeeds every time.

Deploy!

Finally, it is time to deploy to Github. This will trigger a build on Travis, which in turn pushes code to your OpenShift gear on your behalf using the credentials given in .travis.yml.

git add .travis.yml
git commit -m 'Set up Travis build'
git push origin master

Check the Result

Since the deployment to your OpenShift gear will be initiated by Travis, you will not see the deployment result from the git push above. You can check the status with Travis, or you can run:

travis logs -r <USER>/myapp
Author
travis-ci
Website
http://travis-ci.com
Cartridges
ruby-1.9
Repository
https://github.com/travis-ci/openshift-travis-quickstart.git
Tags