Executing shell scripts on Ubuntu
An example workflow of using the container in a workflow on Direktiv.
id: shell
functions:
- id: myshell
image: vorteil/ubuntu-shell:v1
files:
- key: "myscript"
scope: workflow
type: plain
states:
- id: hello
type: action
action:
function: shell
input:
script: "myscript"
args:
- "arg1"
- "arg2"
The action takes two parameters. The first one is 'script' which is a name of a variable containing the script. Usually it comes from a workflow-scoped variable. The seoncd is an array of arguments for the script. The environment variable 'Direktiv_TempDir' is set for the script.
The action returns either JSON with an output of the shell script or a valid JSON if the script return valid json.
#!/bin/bash
ls -la
pwd
{
"output": "output of the shell script\n"
}
#!/bin/bash
echo direktiv > /dev/null
echo '{ "direktiv":"'"$1"'" }'
{
"direktiv": "arg"
}
In the case that an error is encountered, it will present in the following format:
{
"errorCode": "com.ubuntu.error",
"errorMsg": "Something went wrong"
}
Content type
Image
Digest
Size
145.1 MB
Last updated
about 5 years ago
docker pull vorteil/ubuntu-shell