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: [email protected]
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

Currently a student at National University of Singapore. I contribute to opensource projects - primarily PHP and Angular related. I write about PCF and PWS related stuff too.

Leave a Reply