A command is the runtime data resource of a file system that represents a operating system command.
It supports as executable:
Example of a command resource runtime data uri
(hello-world.sh@cd)@tmp
A command runtime data uri has an executionConnection that
Scripts are automatically executable if they contain a shebang (ie the path and argument of their interpreter)
The shebang is the first line of a script
Example with the bash script called hello-world located in the home directory with the shebang #!/usr/bin/env bash
#!/usr/bin/env bash
echo "Hello World"
This script will be executed:
/usr/bin/env bash /home/tabulify/hello-world
Without a shebang, you need to use the binary executable as executable and defines the path in its arguments.
Example: This is the same example as above calling the same bash script but with the binary as executable.
kind: command
spec:
# bin being a connection defined with the directory /usr/bin
data-uri: (env@bin)@tmp
data-def:
arguments:
- bash
- /home/tabulify/hello-world
Example of command kind manifest for a command
kind: command
spec:
# a runtime data uri
data-uri: '(hello-world@home)@tmp'
data-def:
# A list of arguments passed to the command
arguments:
- 'World' # first argument
- .... # second argument
# The location of stdout (Default value)
stdout-data-uri: 'execute/${execution_start_time}-${executable_logical_name}.log@tmp'
# The location of stderr (Default value)
stderr-data-uri: 'execute/${execution_start_time}-${executable_logical_name}-err.log@tmp'
# buffer size used when writing to the std files
std-buffer-size: 8192
# The location of the result returned
# Default to the stdout value if not specified
# but you may specify any other value if your script output is data elsewhere
result-data-uri: 'hello-results.log@tmp'
# time-out in duration
time-out: '60s'
# working directory
working-directory: '/tmp'
All attributes are optional.
| Attributes | Description | |
|---|---|---|
| arguments | Empty List | A list of arguments passed to the command |
| stdout-data-uri | See stdout | A template data uri that specifies the location of stdout |
| stderr-data-uri | See stderr | A template data uri that specifies the location of stderr |
| std-buffer-size | 8192 | The buffer size in bytes when writing to the standard stream (stdout and stderr) |
| result-data-uri | See result | An optional template data uri that specifies the location of the result data path returned |
| time-out | 60s | A timeout in duration format |
| working-directory | the execution connection directory | The working directory of the execution |
A command inherit also all common attributes
stdout-data-uri defines where the standard output of the execution should be stored.
It's a template data uri that accepts
By default, the standard output (stdout) is stored at the runtime temporary connection with the following value:
execute/${execution_start_time}-${executable_logical_name}.log@tmp
stderr-data-uri defines where the standard error of the execution should be stored.
It's a template data uri that accepts
By default, the standard error (stderr) is stored at the runtime temporary connection with the following value:
execute/${execution_start_time}-${executable_logical_name}-err.log@tmp
By default, the returned data resource is the standard output.
If your script outputs logs in standard output and creates data in another location, you may specify it with the result-data-uri.
The working directory specifies where the command execution will take place.
By default, it's the directory of the execution connection.
For instance:
With the working-directory attribute, you can set another value.