Skip to content

cub command run

cub command run

Run a command on a channel

Synopsis

Run a command, and by default wait for its outcome.

The command is resolved to the one channel that declares it, across the organization, or in one space with --space; a command several channels declare has to name its channel with --channel. Options are given as option=value and typed by the channel's declaration: an int option is parsed as a number, a bool as true/false, a json option as JSON, and an entity option (UnitID, TargetID, SpaceID, ChannelID) takes a slug or a UUID. --params supplies a JSON object of options instead of, or as well as, option=value pairs.

The run fails if the client reports Failed or Rejected, or if it expires or times out before the client answers. A channel whose client is not connected holds the run until its deadline.

Examples:

  # Deploy a preview, waiting for the outcome
  cub command run preview.deploy pr=42 sha=0123abcd

  # Name the channel, and come back for the outcome later
  cub command run preview.deploy pr=42 sha=0123abcd --channel previews/preview-bot --wait=false

  # Options as JSON, with a two-minute deadline
  cub command run preview.delete --params '{"pr": 42}' --deadline 2m
cub command run <command> [option=value ...] [flags]

Options

      --channel string    the channel to run it on, when several declare the command
      --deadline string   how long the run waits for the client, as a duration such as 30s or 2m (server default if unset)
  -h, --help              help for run
  -o, --output string     Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
      --params string     options as a JSON object; option=value arguments override its keys
      --quiet             No default output.
      --target string     the Target the run is about, recorded on it
      --timeout string    how long to wait for the outcome, as a duration such as 30s or 2m (default "10m0s")
      --unit string       the Unit the run is about, recorded on it
      --verbose           Detailed output, additive with default output
      --wait              wait for the outcome (default true)

Options inherited from parent commands

      --component string   the Component of --variant, when that names the variant alone; --variant <component>/<variant> says the same in one flag
      --context string     The context to use for this command
      --debug              Debug output
      --space string       space to operate in, by slug or UUID. Omitted, a list or bulk operation spans the organization and a single entity is named as <space>/<slug>; "*" means the same as omitting it
      --variant string     variant to operate in, as <component>/<variant>, or as <variant> with --component: the space naming that Component whose Variant label is <variant>. The same scope as --space, named by what it is rather than by the space's slug; the two cannot be combined

SEE ALSO

  • cub command - List the commands channels declare, and run them