Deprecation warning: Found: env. When I try the solution from the online doc it fails.
- [x] I reviewed open and closed github issues that may be related to my problem.
- [ ] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
- [ ] I attempted to run the command with
CF_TRACE=1to help debug the issue. - [x] I am reporting a bug that others will be able to reproduce.
Details
I deploy my app using cf push app-name -f ./manifest.yml
manifest.yml
I get this warning:
Deprecation warning: Specifying app manifest attributes at the top level is deprecated. Found: env. Please see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#deprecated for alternatives and other app manifest deprecations. This feature will be removed in the future.
I follow the instructions for the Variable Substitution
I create a vars.yml file and substitute the variables in the manifest.yml
vars.yml:
port: 8080
manifest.yml
env:
CF_INSTANCE_PORT: ((port))
$PORT: ((port))
buildpack: liberty-for-java
I run this command cf push app-name --vars-file ./vars.yml -f ./manifest.yml
And I get this error message after the deprecation warning:
FAILED The following flags cannot be used with deprecated usage: vars-file
How can I resolve this deprecation warning?
- Windows 10 64 Enteprise, Git for Windows MINGW64_NT-10.0-17763 3.0.7-338.x86_64 Msys
- cf.exe version 6.46.0+29d6257f1.2019-07-09
- api version: 2.92.0
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/168342200
The labels on this github issue will be updated when the story is started.
Hi @geoangelotti thanks, could you please try changing buildpack to buildpacks in the manifest (the former is deprecated). See this for example. Let us know if you have any questions or problems. Thanks.
Hi team, could you please review as to why the env is returning as deprecated per the example above, thanks.
Using buildpacks fixes the deprecation warning. But I also get an error by doing variable substitution.
Hey @geoangelotti, @ericpromislow and I looked into this and we believe the issue is because you have the env variable defined at the root level of your manifest.yml (which is deprecated regardless of if it has variables in it), and are trying to use variable substitution, which requires you to not be in deprecated mode. To fix this you could embed the variables directly into the single application, or if you still want this at a parent level you can use a .yml anchor with references to your vars file.
manifest.yml
---
defaults: &defaults
env:
CF_INSTANCE_PORT: ((port))
$PORT: ((port))
buildpacks: [ruby_buildpack]
applications:
- name: app1
<<: *defaults
- name: app2
memory: 512M
timeout: 180
instances: 1
<<: *defaults
vars.yml
---
port: 8080
'defaults' becomes the yaml anchor, which are allowed at the root level, whereas anything else besides applications at the root level is deprecated.
Please feel free to re-open this if this does not work for you :) thanks!