buildpacks / pack

CLI for building apps using Cloud Native Buildpacks
https://buildpacks.io
Apache License 2.0
2.56k stars 286 forks source link

Add proccess types to inspect-image output #370

Closed ekcasey closed 4 years ago

ekcasey commented 4 years ago

Depends on buildpack/lifecycle#206

Happy Path

Given an image, <image> with the following metadata in the io.buildpacks.build.metadtata label

{
  "processes": [
    {"type": "web", "command": "/path/to/executable some args", "direct": false},
    {"type": "worker", "command": "/another/command", "direct": true, "args": ["some", "arg"]},
  ],
 ...}

When I run pack inspect-image <image> Then I see the following information in the output

Processes:
  TYPE             SHELL          COMMAND                                    ARGs
  web (default)    bash           /path/to/executable some args
  worker                          /another/command                           some arg

Then pack prints a tip

Tip: To run a particular process or an arbitrary command
          'docker run <image> <process-type>', or
          'docker run <image> <cmd>'

Backwards compatibility (no processes array in label)

Given an image, <image> with a io.buildpacks.build.metadtata label, that is missing the proccesses key When I run pack inspect-image <image> Then I see no Processes: block in the output, or tip

No processes (empty processes array in label)

Given an image, <image> with a io.buildpacks.build.metadtata label, with the following metadata in the io.buildpacks.build.metadtata label

{"processes": []}

When I run pack inspect-image <image> Then I see the following Processes: block

Processes:
 (none)

Then pack will print a warning instead of a tip

Warning: image has no process types, a command must be supplied at runtime:
             'docker run <image> <cmd>'
simonjjones commented 4 years ago

https://github.com/buildpack/pack/pull/397