Description
Please fill out the issue checklist below and provide ALL the requested information.
- [ Y ] I reviewed open and closed github issues that may be related to my problem.
- [ Y ] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
- [ Y ] I attempted to run the command with
CF_TRACE=1
to help debug the issue. - [ Y ] I am reporting a bug that others will be able to reproduce.
Describe the bug and the command you saw an issue with
When specifying a manifest env
var with a JSON value, the value should be quoted so that it is treated as a string:
env:
JSON: '{ wasabi: { is: "good" }, i: { like: "wasabi" } }'
If the user mistakenly enters in the JSON without the quotes, a cf push
using cf cli v6 will output a yaml error. However, a cf push
using cf cli v7 will succeed and transform the JSON into a strange non-JSON format.
What happened
cf push v6 correctly displays an error to the user
cf push v7 succeeds but mangles the JSON
Expected behavior
I would expect the v7 push to display an error and abort the push
Exact Steps To Reproduce
Given the following manifest:
---
applications:
- name: test-app
buildpacks:
- staticfile_buildpack
env:
JSON: { wasabi: { is: "good" }, i: { like: "wasabi" } }
v6 behavior
$ cf version
cf version 6.53.0+8e2b70a4a.2020-10-01
$ cf target
api endpoint: https://api.run.nulldriver.com
api version: 2.150.0
user: admin
org: xtmp
space: xtmp
$ cf push
Pushing from manifest to org xtmp / space xtmp as admin...
Using manifest file /Users/patrickcrocker/git/cf-cli-resource/spec/fixture/static-app/manifest.yml
yaml: unmarshal errors:
line 5: cannot unmarshal !!map into string
FAILED
v7 behavior
$ cf7 version
cf7 version 7.2.0+be4a5ce2b.2020-12-10
$ cf7 target
API endpoint: https://api.run.nulldriver.com
API version: 3.85.0
user: admin
org: xtmp
space: xtmp
$ cf7 push
Pushing app test-app to org xtmp / space xtmp as admin...
Applying manifest file /Users/patrickcrocker/git/cf-cli-resource/spec/fixture/static-app/manifest.yml...
Manifest applied
Packaging files to upload...
Uploading files...
...removed for brevity...
state since cpu memory disk details
#0 running 2020-12-12T17:16:09Z 0.0% 0 of 1G 0 of 1G
$ cf env test-app
Getting env variables for app test-app in org xtmp / space xtmp as admin...
OK
System-Provided:
...removed for brevity...
User-Provided:
JSON: {:i=>{:like=>"wasabi"}, :wasabi=>{:is=>"good"}}
No running env variables have been set
No staging env variables have been set
Notice the mangled format of the JSON
env variable: {:i=>{:like=>"wasabi"}, :wasabi=>{:is=>"good"}}
Provide more context
- Mac OS X 10.15.7 iTerm
Notes regarding V6 and V7 CLI support:
- V6:
- Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
- Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
- V7:
- Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))