Scripts¶
Run Script¶
Runs one .bat/.cmd, PowerShell, Python or shell script from a folder released by the host, once per input item.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
Script folderroot |
text | One of the script folders the administrator has set up. |
Scriptscript |
text | The file to run, from the chosen script folder. |
Argumentsarguments |
text | Command line passed to every script, e.g. --date {{ $json.date }}. Supports expressions. |
Environment variablesenvironment |
key/value pairs | Name → value; next to PIPE_ITEM, PIPE_WORKFLOW, PIPE_EXECUTION, PIPE_ENVIRONMENT and the variables of workflow, group and instance, which these override. In Advanced. |
CredentialcredentialId |
credential | Its fields are passed as PIPE_CREDENTIAL_<FIELD>; their values are masked in output and logs. |
Error patternerrorPattern |
text | A script also fails when a line of its output matches this regular expression, e.g. ^ERROR|Traceback. In Advanced. |
Ignore caseignoreCase |
true/false | The error pattern ignores capitals, so ERROR also matches error. In Advanced. Default: true. |
Timeout per script (minutes)timeoutMinutes |
number | A script that runs longer is stopped and fails. In Advanced. Default: 10. |
Example: Run a backup script
One run per input item; the output item tells whether it worked, with exit code and what the script printed.
Parameters:
{
"root": "ops",
"script": "backup.ps1",
"arguments": "--target {{ $json.server }}"
}
Input:
[
{
"server": "db01"
}
]
Output:
[
{
"script": "backup.ps1",
"success": true,
"exitCode": 0,
"reason": null,
"matchedLine": null,
"stdout": "Backup of db01 done: 2.1 GB\n",
"stderr": "",
"durationMs": 18420
}
]
Run Scripts Folder¶
Runs the switched-on scripts of a folder released by the host, in order, once per input item. One output item per script with exit code and output.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
Script folderroot |
text | One of the script folders the administrator has set up. |
Pathpath |
text | File or folder inside the script folder; empty for all of it. |
Include subfoldersincludeSubfolders |
true/false | Offer the scripts in the subfolders of the path too. Default: false. |
Scriptsscripts |
list | Run top to bottom, each in its own process; files added later are off until switched on. |
Stop on first failurestopOnFirstFailure |
true/false | Don't run the remaining scripts after one failed. Default: true. |
Argumentsarguments |
text | Command line passed to every script, e.g. --date {{ $json.date }}. Supports expressions. |
Environment variablesenvironment |
key/value pairs | Name → value; next to PIPE_ITEM, PIPE_WORKFLOW, PIPE_EXECUTION, PIPE_ENVIRONMENT and the variables of workflow, group and instance, which these override. In Advanced. |
CredentialcredentialId |
credential | Its fields are passed as PIPE_CREDENTIAL_<FIELD>; their values are masked in output and logs. |
Error patternerrorPattern |
text | A script also fails when a line of its output matches this regular expression, e.g. ^ERROR|Traceback. In Advanced. |
Ignore caseignoreCase |
true/false | The error pattern ignores capitals, so ERROR also matches error. In Advanced. Default: true. |
Timeout per script (minutes)timeoutMinutes |
number | A script that runs longer is stopped and fails. In Advanced. Default: 10. |
Example: The nightly scripts in order
One output item per script. When one fails, the node fails; with 'Stop on first failure' the rest doesn't run.
Parameters:
{
"root": "ops",
"path": "nightly/",
"scripts": [
{
"value": "nightly/1-export.py",
"enabled": true
},
{
"value": "nightly/2-cleanup.sh",
"enabled": true
}
]
}
Output:
[
{
"script": "nightly/1-export.py",
"success": true,
"exitCode": 0,
"reason": null,
"matchedLine": null,
"stdout": "Exported 1240 rows\n",
"stderr": "",
"durationMs": 5210
},
{
"script": "nightly/2-cleanup.sh",
"success": true,
"exitCode": 0,
"reason": null,
"matchedLine": null,
"stdout": "Removed 3 old files\n",
"stderr": "",
"durationMs": 140
}
]
Run Scripts Repo¶
Clones a repository of a configured Git server for the run and runs its switched-on scripts in order, with the repository root as working directory (PIPE_WORK_DIRECTORY). The clone is deleted afterwards.
Inputs: main · Outputs: main
| Parameter | Type | Description |
|---|---|---|
Git serverserver |
text | A Git server configured by the host. |
Repositoryrepository |
text | A repository of the chosen Git server. |
Branchbranch |
text | Empty for the repository's default branch. |
Pathpath |
text | File or folder inside the repository; empty for all of it. |
Include subfoldersincludeSubfolders |
true/false | Offer the scripts in the subfolders of the path too. Default: false. |
Scriptsscripts |
list | Run top to bottom, each in its own process; files added later are off until switched on. |
Stop on first failurestopOnFirstFailure |
true/false | Don't run the remaining scripts after one failed. Default: true. |
Argumentsarguments |
text | Command line passed to every script, e.g. --date {{ $json.date }}. Supports expressions. |
Environment variablesenvironment |
key/value pairs | Name → value; next to PIPE_ITEM, PIPE_WORKFLOW, PIPE_EXECUTION, PIPE_ENVIRONMENT and the variables of workflow, group and instance, which these override. In Advanced. |
CredentialcredentialId |
credential | Its fields are passed as PIPE_CREDENTIAL_<FIELD>; their values are masked in output and logs. |
Error patternerrorPattern |
text | A script also fails when a line of its output matches this regular expression, e.g. ^ERROR|Traceback. In Advanced. |
Ignore caseignoreCase |
true/false | The error pattern ignores capitals, so ERROR also matches error. In Advanced. Default: true. |
Timeout per script (minutes)timeoutMinutes |
number | A script that runs longer is stopped and fails. In Advanced. Default: 10. |
Example: Deployment scripts from Git
The repository is cloned for the run and deleted afterwards; each output item also names the commit that ran.
Parameters:
{
"server": "gitea",
"repository": "ops-scripts",
"branch": "main",
"scripts": [
{
"value": "deploy/update.ps1",
"enabled": true
}
]
}
Output:
[
{
"script": "deploy/update.ps1",
"success": true,
"exitCode": 0,
"reason": null,
"matchedLine": null,
"stdout": "Updated 2 services\n",
"stderr": "",
"durationMs": 9310,
"commit": "4f2c9a1"
}
]