Execute (Shell & JavaScript)
Plugin allows to invoke any shell command.
Available actions:
  • exec - execute single command
  • shell - execute shell script
  • fn - execute JS function

Action Handler: Shell Command

Invoice single shell command.
ID: com.fireblink.fbl.exec
Aliases:
  • fbl.exec
  • exec
Example:
1
exec:
2
# executable to invoke
3
command: 'echo'
4
5
# additional executable arguments, note "command" cannot have arguments in its value, just executable alias or path to it
6
args:
7
- 'test'
8
9
# [optional] working directory to run command from.
10
# Default value: flow's folder
11
wd: <%- cwd %>
12
13
# [optional] options
14
options:
15
# [optional] if provided "stdout" will be included inside assigned object to proviced "ctx" and/or "secrets" name
16
stdout: true
17
# [optional] if provided "stderr" will be included inside assigned object to proviced "ctx" and/or "secrets" name
18
stderr: true
19
# [optional] if provided - stdout and stderr will be logged in report and printed to console
20
verbose: false
21
22
# [optional] assign execution result {code: 0-255, stdout?: string, stderr?: string }
23
assignResultTo: # follows common assignment logic practicies https://fbl.fireblink.com/plugins/common#assign-to
24
25
# [optional] push execution result {code: 0-255, stdout?: string, stderr?: string }
26
pushResultTo: # follows common push logic practicies https://fbl.fireblink.com/plugins/common#push-to
Copied!

Action Handler: Shell Script

Invoke shell script. While it gives a more convinient way to integrate shell scripts into the flow it also makes your flow less platform agnostic.
ID: com.fireblink.fbl.shell
Aliases:
  • fbl.shell
  • shell
Example:
1
shell:
2
# shell executable
3
executable: '/bin/bash'
4
5
# script to be invoked
6
script: |-
7
cd /tmp
8
touch test.txt
9
10
# [optional] working directory to run script from.
11
# Default value: flow's folder
12
wd: <%- cwd %>
13
14
# [optional] options
15
options:
16
# [optional] if provided "stdout" will be included inside assigned object to proviced "ctx" and/or "secrets" name
17
stdout: true
18
# [optional] if provided "stderr" will be included inside assigned object to proviced "ctx" and/or "secrets" name
19
stderr: true
20
# [optional] if provided - stdout and stderr will be logged in report and printed to console
21
verbose: false
22
23
# [optional] assign execution result {code: 0-255, stdout?: string, stderr?: string }
24
assignResultTo: # follows common assignment logic practicies https://fbl.fireblink.com/plugins/common#assign-to
25
26
# [optional] push execution result {code: 0-255, stdout?: string, stderr?: string }
27
ushResultTo: # follows common push logic practicies https://fbl.fireblink.com/plugins/common#push-to
Copied!

Action Handler: Function

Allows to invoke custom JavaScript script (ES6). Script has access to all context variables:
  • cwd
  • ctx
  • secrets
  • parameters
  • iteration
But also to Node.js require function and can interact with awailable node modules. Though, it is recomended to use fbl plugins instead.
ID: com.fireblink.fbl.function
Aliases:
  • fbl.function
  • function
  • function()
  • fn
  • fn()
Example: Direct Changes
1
# Action handler expects valid JS function content string.
2
#
3
# Note: script is wrapped into async function, so you can "await" promises inside it
4
# if you need to do some long running operations.
5
fn: |-
6
ctx.isWindows = require('os').platform() === 'win32';
Copied!
Example: Overrides
Alternativelly function can return object that will be used to override entire state of context and parameters fields.
1
fn: |-
2
return {
3
cwd: '/tmp',
4
ctx: {
5
test: true
6
}
7
}
Copied!
1
fn: |-
2
return {
3
secrets: {
4
test: true
5
},
6
parameters: {
7
p1: ctx.p2
8
}
9
}
Copied!
Last modified 1yr ago