Zohar Meir
Zohar Meir

Reputation: 595

cf v3-push with manifest and variable substitution

I have a v3 app that I want to deploy to 2 different environments. The app name and some definitions vary from env to env, but the structure of the manifest is the same. For example:

# manifest_test.yml
applications:
- name: AppTest
  processes:
    - type: web
      command: start-web.sh
      instances: 1
    - type: worker
      command: start-worker.sh
      instances: 1

# manifest_prod.yml
applications:
- name: AppProd
  processes:
    - type: web
      command: start-web.sh
      instances: 3
    - type: worker
      command: start-worker.sh
      instances: 5

Instead of keeping duplicate manifests with only minor changes in variables, I wanted to use a single manifest with variable substitution. So I created something like this:

# manifest.yml
- name: App((env))
  processes:
    - type: web
      command: start-web.sh
      instances: ((web_instances))
    - type: worker
      command: start-worker.sh
      instances: ((worker_instances))

However, it seems like cf v3-apply-manifest doesn't have an option to provide variables for substitution (as cf push did).

Is there any way around this, or do I have to keep using a separate manifest for each environment?

Upvotes: 0

Views: 1922

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

Please try one of the cf v7 cli beta releases. I didn't test it but the output from cf7 push -h has a flag for using --vars and --vars-file. It should also use the v3 APIs so it will support things like rolling deploy.

For what it's worth, if you're looking to use CAPI v3 features you should probably use the cf7 beta releases going forward. That is going to get you the latest and greatest support for the CAPI v3.

Hope that helps!

Upvotes: 0

Related Questions