Search This Blog

Friday 19 August 2016

Variable substitution for a manifest.yml for Cloud Foundry

Pushed applications to CF or PCF you would of most likely used a manifest.yml file and at some point wanted to use variable substitution. manifest.yml files don't support that and a feature request has been asked for this as follows

https://github.com/cloudfoundry/cli/issues/820

With a recent customer we scripted the creation of a manifest.yml file from a Jenkins job  which would inject the required ROUTE to the application by creating the manifest.yml through a script as follows as shown below.

manifest-demo.sh

export ROUTE=$1

echo ""
echo "Setting route to $ROUTE ..."
echo ""

cat > manifest.yml <<!
---
applications:
- name: gs-rest-service
  memory: 256M
  instances: 1
  host: $ROUTE
  path: target/gs-rest-service-0.1.0.jar
!

cat manifest.yml

Script tested as follows

pasapicella@pas-macbook:~/bin/manifest-demo$ ./manifest-demo.sh apples-route-pas

Setting route to apples-route-pas ...

---
applications:
- name: gs-rest-service
  memory: 256M
  instances: 1
  host: apples-route-pas
  path: target/gs-rest-service-0.1.0.jar

No comments: