Eitan Volach
Eitan Volach

Reputation: 56

Is there a way in cloud foundry cf push command to have a manifest.yml with several "profiles"?

We have different setups (deployment parameters) for prod and for non prod environments, in regards to memory, instances etc.

We are deploying our applications with Jenkins pipeline, on Pivotal Cloud Foundry environments, which is eventually calling a script with a "CF push" command.

We are examining using two different manifest.yml files (but dislike the duplicity if identical parameters). We are also examining using --var-file with two different vars files. We have a concern with backward compatibility, and the effort (we have many MSs) of adding so many files.

We want a manifest.yml that will look like this:

applications:
- name: myAppName
  services:
  - discovery
  - config-server
profile:
  dev:
    memory: 1024M
    instances: 1
  prod:
    memory: 4096M
    instances: 4

Assuming we will need to pass a parameter profile=dev to the cf push command is fine.

In DEV environment 1 instance with 1024M of memory will be deployed; while in PROD environments, 4 instances with 4096M of memory will be deployed.

Upvotes: 1

Views: 3210

Answers (2)

Daniel Mikusa
Daniel Mikusa

Reputation: 15041

I suggest that you reconsider using variables in your manifest. You can use --var-file, but if you want to avoid having those files present you can just pass in multiple --var=<name>=<val> arguments instead.

That or just have dev.yml and prod.yml files, you can then cf push -f dev.yml or cf push -f prod.yml and pick between the two. There's a little duplication, but the files are tiny so it shouldn't be a big deal.

Hope that helps!

Upvotes: 3

Arun
Arun

Reputation: 3680

I don’t think, trying to achieve everything using CF CLI commands is the right way to do

I would achieve this much simply by writing a bash script and executing cf-push sequencely in whichever fashion I would like to have..

Upvotes: 0

Related Questions