After having used the CloudFoundry plugin for Jenkins for a bit we found that the BM API was periodically erroring out and returning such things as:
400 Bad Request
and
Java.net.SocketTimeoutException: Read timed out
and
502 Bad Gateway
So I installed the cf tools on the jenkins server and was many times able to get successful build pushed to bluemix by running an Excecute Shell in the Build Step with the following commands:
cd public;
npm install;
gulp build;
cd ../;
sudo cf api https://api.ng.bluemix.net;
sudo cf login -u [email protected] -o organization.com -s staging -p password;
sudo cf push MyNodeApp-staging;
If you are binding to services, like mongodb, the trick is to have a manifest.yml file in the root of the project (should be in .gitignore if you pushing multiple branches) In this case the manifest looks like:
applications: - services: - mongodb-H disk_quota: 1024M host: MyNodeApp-staging name: MyNodeApp-staging path: . domain: mybluemix.net instances: 1 memory: 256M env: NODE_ENV: staging
Where the service name to bind to is specified and the environment variable NODE_ENV is passed through for the application to handle environmental case switching.
thanks. this actually solved my problem