Version 4: add helm support
Version 3: add kubectl support
Version 2: add kubekey support
Version 1: raw version
Ubuntu bash environment
This function provides a Ubuntu 22.04 environment. The following packages are installed:
The function can run multiple commands but if multiple commands have to be chained together or use pipes it requires a 'bash -c' command, e.g. bash -c 'cd dir && cat file.txt > newfile'
functions:
- id: bash
image: gcr.io/direktiv/functions/bash:1.0
type: knative-workflow
- id: bash
type: action
action:
function: bash
input:
commands:
- command: ls -la
- id: bash
type: action
action:
function: bash
input:
files:
- name: hello.sh
data: |-
#!/bin/bash
echo "Hello World"
mode: '0755'
commands:
- command: ./hello.sh
- id: bash
type: action
action:
function: bash
input:
commands:
- command: 'bash -c "echo { \\\"hello\\\": \\\"world\\\" } > data.json"'
- command: cat data.json
- id: bash
type: action
action:
function: bash
input:
commands:
- command: bash -c 'echo "File Data" > myfile.txt'
- command: cat myfile.txt
No secrets required
List of executed commands.
[
{
"result": "",
"success": true
},
{
"result": {
"hello": "world"
},
"success": true
}
]
| Type | Description |
|---|---|
| io.direktiv.command.error | Command execution failed |
| io.direktiv.output.error | Template error for output generation of the service |
| io.direktiv.ri.error | Can not create information object from request |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| bash | []PostOKBodyBashItems | []*PostOKBodyBashItems |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| result | interface{} | interface{} | ✓ | |||
| success | boolean | bool | ✓ |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| commands | []PostParamsBodyCommandsItems | []*PostParamsBodyCommandsItems | Array of commands. | |||
| files | []DirektivFile | []apps.DirektivFile | File to create before running commands. |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| command | string | string | Command to run | ls -la | ||
| continue | boolean | bool | Stops excecution if command fails, otherwise proceeds with next command | |||
| envs | []PostParamsBodyCommandsItemsEnvsItems | []*PostParamsBodyCommandsItemsEnvsItems | Environment variables set for each command. | [{"name":"MYVALUE","value":"hello"}] | ||
| boolean | bool | true | If set to false the command will not print the full command with arguments to logs. | |||
| silent | boolean | bool | If set to false the command will not print output to logs. |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| name | string | string | Name of the variable. | |||
| value | string | string | Value of the variable. |
Content type
Image
Digest
sha256:168fca6fa…
Size
1.3 GB
Last updated
over 3 years ago
docker pull westwind027/bash