jumppad icon indicating copy to clipboard operation
jumppad copied to clipboard

Exec command

Open nicholasjackson opened this issue 5 years ago • 1 comments

Shipyard should have an exec command which allows interactive shell to a container, pod or nomad job.

The UX around the shell should have the following options:

  1. All in one
shipyard exec [target] [job | pod] [task | container] -- [command: default shell]

# container in a Nomad job, run `ls`
shipyard exec cluster.nomad product-api api-service  -- ls

# container in Kubernetes pod, default shell
shipyard exec cluster.nomad product-api api-service

# docker container, default shell
shipyard exec container.consul

Notes:

  • Should the target pod, etc be slash separated, flag based, or space delimited?
  • Shipyard should determine if bash or zsh is available and default to that if possible rather than sh
  1. Interactive Mode
$ shipyard exec

# Which target would you like to use?
[1] Consul Container
[2] Kuberentes Cluster
[3] Nomad (cluster)

$ 3

# Would you like to access the node or a job?
[1] Node
[2] Job (default)

$ 2

# What job in the Nomad cluster would you like to use?
[1] Products API
[2] Front end service

$ 1

# Which container would you like to attach to?
[1] Products Service
[2] Envoy Sidecar

$ 1

# What command would you like to execute (press return for default shell)?

$ ls -lha

Notes:

  • Interactive mode should be able to pick up from a partial exec, for example only if the cluster and job was specified in the command. Interactive mode should prompt for container and command.
  • If there is only one option then the question should be skipped.
  1. Bash Autocomplete
$ shipyard exec con[tab]

Consul Cluster  Consul Container  Confluence Container

nicholasjackson avatar Jan 24 '20 12:01 nicholasjackson

This has been partially implemented, leaving open as the UX needs to be completed and Nomad usecase implemented.

nicholasjackson avatar Feb 23 '20 23:02 nicholasjackson