Skip to main content

runShell

Perform a native shell command.

Fields

FieldTypeDescriptionDefault
idstringOptional. ID of the step.Generated UUID
descriptionstringOptional. Description of the step.
actionstringRequired. The action to perform.
commandstringRequired. Command to perform in the machine's default shell.
argsarray of stringsOptional. Arguments for the command.[]
workingDirectorystringOptional. Working directory for the command..
exitCodesarray of integersOptional. Expected exit codes of the command. If the command's actual exit code isn't in this list, the step fails.[0]
outputstringOptional. Content expected in the command's output. If the expected content can't be found in the command's output (either stdout or stderr), the step fails. Supports strings and regular expressions. To use a regular expression, the string must start and end with a forward slash, like in /^hello-world.*/.
savePathstringOptional. File path to save the command's output, relative to saveDirectory.
saveDirectorystringOptional. Directory to save the command's output. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory.
maxVariationintegerOptional. Allowed variation in percentage of text different between the current output and previously saved output. If the difference between the current output and the previous output is greater than maxVariation, the step fails. If output doesn't exist at savePath, this value is ignored.0
overwritestringOptional. If true, overwrites the existing output at savePath if it exists.
If byVariation, overwrites the existing output at savePath if the difference between the new output and the existing output is greater than maxVariation.

Accepted values: true, false, byVariation
false
timeoutintegerOptional. Max time in milliseconds the command is allowed to run. If the command runs longer than this, the step fails.60000
setVariablesarray of objectsOptional. Extract environment variables from the command's output.[]
setVariables.namestringRequired. Name of the environment variable to set.
setVariables.regexstringRequired. Regex to extract the environment variable from the command's output.

Examples

{
"action": "runShell",
"command": "echo",
"args": [
"$USER"
]
}
{
"action": "runShell",
"command": "echo",
"args": [
"hello-world"
],
"id": "ddec5e20-2e81-4f38-867c-92c8d9516755",
"description": "This is a test!"
}
{
"action": "runShell",
"command": "docker run hello-world",
"timeout": 20000,
"exitCodes": [
0
],
"output": "Hello from Docker!"
}
{
"action": "runShell",
"command": "false",
"exitCodes": [
1
]
}
{
"action": "runShell",
"command": "echo",
"args": [
"setup"
],
"exitCodes": [
0
],
"output": "/.*?/",
"setVariables": [
{
"name": "TEST",
"regex": ".*"
}
]
}
{
"action": "runShell",
"command": "docker run hello-world",
"workingDirectory": ".",
"exitCodes": [
0
],
"output": "Hello from Docker!",
"savePath": "docker-output.txt",
"saveDirectory": "output",
"maxVariation": 10,
"overwrite": "byVariation"
}