Skip to content

/v2/apps/<guid>/summary does't return newly set env var unless app is restarted. #1572

@stephanme

Description

@stephanme

Issue

/v2/apps/<guid>/summary does't return newly set env var unless app is restarted.

Context

Looks like a regression in capi-release v1.91.0 / cf-deployment 12.33.0.
Worked in capi-release v1.89.0 / cf-deployment 12.25.0

Steps to Reproduce

  1. Deploy a testapp. e.g. in a directory with an index.html file:
cf push testapp -m 128M -b binary_buildpack -c "python3 -m http.server 8080" --random-route
  1. Set an env var
cf set-env testapp HELLO WORLD
  1. Check that env var is set with /v2/apps/<guid>/env endpoint
cf curl /v2/apps/$(cf app testapp --guid)/env
{
   ...
   "environment_json": {
      "HELLO": "WORLD"   <-- OK
   },
   "system_env_json": {
      "VCAP_SERVICES": {}
   },
   "application_env_json": {
      "VCAP_APPLICATION": {
         ...
         "application_name": "testapp",
         ...
      }
   }
}
  1. Check that env var is set with /v2/apps/<guid>/summary endpoint
cf curl /v2/apps/$(cf app testapp --guid)/summary
{
   "guid": "c2f01f96-8427-4d5e-bf00-1177249c1fe1",
   "name": "testapp",
   ...
   "buildpack": "binary_buildpack",
   "detected_buildpack": "binary",
   "detected_buildpack_guid": "27676514-5ef3-4789-8a15-a48cf2fb620b",
   "environment_json": {},  <-- FAILURE: should not be empty
   ...
}
  1. Restart app with cf restart testapp

  2. Check that env var is set with /v2/apps/<guid>/summary endpoint

cf curl /v2/apps/$(cf app testapp --guid)/summary
{
   "guid": "c2f01f96-8427-4d5e-bf00-1177249c1fe1",
   "name": "testapp",
   ...
   "buildpack": "binary_buildpack",
   "detected_buildpack": "binary",
   "detected_buildpack_guid": "27676514-5ef3-4789-8a15-a48cf2fb620b",
   "environment_json": {
      "HELLO": "WORLD"    <-- OK
   },
   ...
}

Expected result

environment_json in step 4 (summary endpoint) should contain HELLO var, i.e. show the same result as in step 6 after the restart or as in step 3 (env endpoint).

Current result

environment_json in step 4 (summary endpoint) is empty, i.e. the set env vars are missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions