Open KhasDenis opened 4 years ago
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/172497035
The labels on this github issue will be updated when the story is started.
Hi @KhasDenis,
Does the Process resource show the correct information - https://v3-apidocs.cloudfoundry.org/version/3.83.0/index.html#processes ? You can get to the correct object by looking at the links.processes
in the /v3/apps/:guid
response.
Hi @aashah,
Yes we tried processes, but there is a difference to V2 apps behaviour. V2 Application endpoint returned either custom startup command (if application has been started with -c) or null. V3 Processes always return command and it seems there is no consistant way to distinguish between custom startup command and buildpack startup command.
Hey @KhasDenis
Sorry for the delay in getting back to you.
You're right, it doesn't look like we may be distinguishing a user specified start command from the detected one from buildpacks. I'm also guessing that it was fairly accidental that it was ever separated in the first place. Before making a feature story to consider & add that to V3, I'd love to dig at your use case.
Could you expand more on your workflow that includes detecting this distinction?
Hi @aashah
We are implementing Conformity Monkey for Cloud Foundry installation. The goal is to have applications pushed by developers conform to some predefined rules. Applications which use custom startup command considered as special case and should be detected.
@KhasDenis I think you can get the information you need by comparing the process's command with the command returned from staging on the droplet.
For example, an app pushed without the -c
flag:
cf push command
...
cf curl /v3/apps/73eacc19-af84-4c2d-85f2-f8951a27b95c/processes/web | jq .command
"bundle exec rackup config.ru -p $PORT"
cf curl /v3/apps/73eacc19-af84-4c2d-85f2-f8951a27b95c/droplets/current | jq .process_types.web
"bundle exec rackup config.ru -p $PORT"
Note that the two values are equal. For an app pushed with the -c
flag:
cf push command -c 'bundle exec rackup config.ru -p $PORT && echo "hi"'
...
cf curl /v3/apps/73eacc19-af84-4c2d-85f2-f8951a27b95c/processes/web | jq .command
"bundle exec rackup config.ru -p $PORT && echo \"hi\""
cf curl /v3/apps/73eacc19-af84-4c2d-85f2-f8951a27b95c/droplets/current | jq .process_types.web
"bundle exec rackup config.ru -p $PORT"
Note that the values are different.
Does this meet your needs @KhasDenis?
Issue
V2 to V3 migration: Application custom startup command
Context
In our client application we need to know whether cf application has been started with custom command or not. V2 API provided this information through different ways. One of them is
curl -ik "https://[api.url]/v2/apps/[guid]" -X GET -H "Authorization: .."
. Application Entity command field contains either custom command or null. This field does not exist in V3 and there is no other way to get this information.Steps to Reproduce
cf push any-app -c "./custom-start.sh" -f manifest.yml
curl -ik "https://[api.url]/v2/apps/[guid]" -X GET -H "Authorization: .." curl -ik "https://[api.url]/v3/apps/[guid]" -X GET -H "Authorization: .."
Expected result
Way to get custom command using purely V3 API.