Skip to main content

Loop Script Plugins (Enterprise)


Loop Script Plugins (Enterprise)

These plugins add the functionality of running inline scripts, using the node executor and file copier, inside a loop. So far the plugin has two different iteration types: iterating a JSON array and iterating the script until it finishes successful (exit code zero)

Included Plugins

  • Loop / Node Step / Run Script from a Json Array
  • Loop / Node Step / Run Script until Success

Run Script from a Json Array

This node step plugin runs an inline script based on a provided JSON Array (per each node).
In order to capture the JSON array in previous steps (data context), you can use the Loop / Log Filter / Store and Validate JSONopen in new window log filter plugging.

Plugin Configuration

  • Input array data from context: JSON array from data context (eg: data.json). This value must be captured in a previous step with a Log Filter.
  • Input Array (raw string): (Optional) If you don't want to use data context you can add here the raw JSON array.
  • Script: Script to Run
  • Invocation String: (Optional) add the invocation string like: bash, powershell, python, etc
  • File Extension: (Optional) add the file extension string like: .sh, .ps1, .py, etc
  • Stop Iteration on failure: Stop execution if the iteration failed

The input JSON array must be a simple key/value JSON array:

Tips

The JSON provided cannot have spaces in the attribute name, this is allowed just for the values

[ 
  {"id":"1","name":"test 1"},
  {"id":"2","name":"test 2"}
]

Then, the script will run for each of JSON object included in the input array. Inside the inline scripts you can capture the variables from each JSON object using the following convention ($vars.key):

set -e
token="@option.token"
id="$vars.id"
name="$vars.name"

echo "token: $token"
echo "id: $id"
echo "name: $name"
plugin-step-config
plugin-step-config
plugin-step-definition
plugin-step-definition
plugin-step-output
plugin-step-output

Run Script until Success

This node step plugin runs an inline script until it finishes successfully (per each node)

Plugin Configuration

  • Retries: Max number of iterations
  • Retry Delay: Retry Delay in seconds
  • Script: Script to Run
  • Invocation String: (Optional) add the invocation string like: bash, powershell, python, etc
  • File Extension: (Optional) add the file extension string like: .sh, .ps1, .py, etc
plugin-step-config
plugin-step-config