run service executable

Execute an executable service

Synopsis

Run

This command will execute an executable service and display the resulting stdout, stderr, return code, as well as execution time information.

When running an executable service, you can specify arguments using the --set flag. The --set flag takes in a key=value syntax. Any variables passed in using --set will be validated against the decorator if one was defined during the service's creation.

How Arguments Are Passed

The format in which arguments are passed to your executable depends on the --arg-format specified when the service was created. The default format is --{{.Key}} {{.Value}}, which means arguments will be passed as command-line flags.

For example, if you run:

>_ torero run service executable my-script --set device=10.0.0.1 --set port=22

With the default --arg-format "--{{.Key}} {{.Value}}", torero will execute:

/path/to/executable --device 10.0.0.1 --port 22

If your service was created with --arg-format "{{.Key}}={{.Value}}", it would execute:

/path/to/executable device=10.0.0.1 port=22

Make sure your executable can properly parse arguments in the format specified during service creation.

Runtime Secrets

Secrets can be injected at runtime using the --set-secret flag. Runtime secrets will be merged with or override the secrets defined on the service during creation. The --set-secret flag uses the same comma-separated syntax as the create command:

--set-secret name=my-secret,type=env,target=ENV_VAR_NAME

This allows you to dynamically inject or override secrets without modifying the service definition.

torero run service executable <service-name> [flags]

Examples

Simple Example

Run a simple executable service called backup-script with no arguments.

>_ torero run service executable backup-script

Setting Arguments

Run an executable service called network-config that accepts device and interface arguments.

>_ torero run service executable network-config \
--set device=router-01 \
--set interface=eth0

Using Runtime Secrets

Run an executable service and inject a secret at runtime that will be available as an environment variable.

>_ torero run service executable api-caller \
--set endpoint=https://api.example.com \
--set-secret name=api-token,type=env,target=API_TOKEN

Complex Example

Run an executable service with multiple arguments and a runtime secret.

>_ torero run service executable deployment-script \
--set environment=production \
--set region=us-east-1 \
--set replicas=3 \
--set-secret name=deploy-key,type=env,target=DEPLOY_KEY

Options

  -h, --help                     help for executable
      --set stringArray          Sets an input argument to be passed into the script via the CLI when executed.
                                 If a decorator is defined, the inputs must match when is defined in the
                                 decorator. If a decorator is not defined you may pass in any arguments.
      --set-secret stringArray   Secret to be used during script execution. These will be merged with or override
                                 the secrets defined on the service.
      --use                      Display the possible inputs of the script via the decorator.

Options inherited from parent commands

      --config string   Specify the path to the configuration file
      --raw             Displays the result of the command in its raw format
      --verbose         Enable verbose output

SEE ALSO