TravisCI Cloud Foundry Deployment: Use Dashes!

TravisCI Gotcha for Cloud Foundry

Summary: Use dashes for naming Cloud Foundry ‘Organization’ and ‘Space’. Do not use spaces/blanks!

Using spaces in my Cloud Foundry ‘Organization’ and ‘Space’ name caused quite some trouble for me during my TravisCI deployment process. Originally, my Cloud Foundry ‘Organization’ and ‘Space’ is as follows:

API endpoint: https://api.run.pivotal.io
User: thatsmyemail@example.com
Org: Some Big Organization
Space: cloud production api

With the following travis.yml

deploy:
  provider: cloudfoundry
  edge: true
  username: thatsmyemail\@example.com
  password:
    secret: somereallysecretivesecret
  api: https://api.run.pivotal.io
  organization: Some Big Organization
  space: cloud production api
  on:
    branch: master

This caused TravisCI’s Cloud Foundry deployment gem to read my stated configuration as the following:

deploy:
  provider: cloudfoundry
  edge: true
  username: thatsmyemail\@example.com
  password:
    secret: somereallysecretivesecret
  api: https://api.run.pivotal.io
  organization: Some
  space: cloud
  on:
    branch: master

This will cause deployment failure because the interpreted ‘Organization’ and ‘Space’ simply doesn’t exists.

To fix this issue, I just replaced the spaces in my ‘Organization’ and ‘Space’ with dashes. Take note that TravisCI doesn’t automatically escape special characters, so you’ll have to do it on your own.  In this scenario, I have done so by adding backslashes to my dashes.

deploy:
  provider: cloudfoundry
  edge: true
  username: thatsmyemail\@example.com
  password:
    secret: somereallysecretivesecret
  api: https://api.run.pivotal.io
  organization: Some\-Big\-Organization
  space: cloud\-production\-api
  on:
    branch: master

Thereafter, this issue is fixed and TravisCI can finally read my configuration properly and deploy correctly!

Author: Woo Huiren

Howdy, I'm a IT student who is currently serving my full time national service. I do lots of things related to IT but I have an exceptionally great love for the web and opensource, so expect me to blog a lot about it! :)

Leave a Reply