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 Workflow steps Plugins

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

Run Script from a Json Array

This plugin runs an inline script based on a provided JSON Array.
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 and is expecting an array element.
  • Input Array (raw string): (Optional) If you don't want to use data context you can add a 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:

[
  {"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-configplugin-configplugin-config

Run Script until Success

This plugin runs an inline script until it finishes successfully

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-config
plugin-config