Skip to main content

opctl run

Run an op

Synopsis

OP_REF can be either a 'relative/path', '/absolute/path', 'host/path/repo#tag', or 'host/path/repo#tag/path'.

If an opctl node isn't reachable, one will be started automatically.

If auth w/ the op source fails the CLI will (re)prompt for username & password. In non-interactive terminals, the CLI will note that it can't prompt due to being in a non-interactive terminal and exit with a non zero exit code.

Op input args are obtained from the following sources in order:

  • arg provided via -a option
  • arg file
  • env var
  • default
  • prompt

If valid input args cannot be obtained, the CLI will prompt for them. In non-interactive terminals, the CLI will provide details about the invalid or missing input, note that it's giving up due to being in a non-interactive terminal and exit with a non zero exit code.

If provided args don't meet input constraints, the CLI will (re)prompt until a valid arg is obtained.

All ops &/or images pulled will be cached.

Pulling any updates to referenced images will be attempted prior to container creation. If pulling an updated image fails, graceful fallback to the cached image will occur.

All containers created by opctl will be attached to an overlay network and made accessible from the opctl node and other opctl containers by their name. Containers will be removed as they exit.

opctl run OP_REF [flags]

Examples

# Run the op defined in the '.opspec/myOp' directory of the current working directory.
opctl run myOp

# Run the op defined in the root directory of the 'github.com/opspec-pkgs/slack.chat.post-message' git
# repository commit tagged '1.1.0'. Pass arguments for 'apiToken', 'channelName', and 'msg' inputs.
opctl run -a apiToken="my-token" -a channelName="my-channel" -a msg="hello!" github.com/opspec-pkgs/slack.chat.post-message#1.1.0

Options

      --arg-file string    Read in a file of args in yml format (env $OPCTL_RUN_ARG_FILE) (default ".opspec/args.yml")
-a, --args stringArray Explicitly pass args to the op (env $OPCTL_RUN_ARGS)
-h, --help help for run
--no-progress Disable live call graph for the op (env $OPCTL_RUN_NO_PROGRESS)

Options inherited from parent commands

      --api-listen-address string   IP:PORT on which the API server will listen (env $OPCTL_API_LISTEN_ADDRESS) (default "127.0.0.1:42224")
--container-runtime string Runtime for opctl containers. Can be 'docker' (deprecated), 'k8s', or 'embedded' (env $OPCTL_CONTAINER_RUNTIME) (default "docker")
--data-dir string Path of dir used to store opctl data (env $OPCTL_DATA_DIR) (default "/root/opctl")
--dns-listen-address string IP:PORT on which the DNS server will listen (env $OPCTL_DNS_LISTEN_ADDRESS) (default "127.0.0.1:53")
--no-color Disable output coloring (env $OPCTL_NO_COLOR)

SEE ALSO

  • opctl - Opctl is a free and open source distributed operation control system