Skip to content

Add forEach key to iterate over values in workflow steps #439

@yottahmd

Description

@yottahmd

This feature would allow users to specify a list of values and then execute a command on each of those values.

The forEach key would be added to the YAML file to specify the list of values to iterate over, and each value would be passed as a parameter named $_, borrowed from Perl's syntax.

For example, the following YAML file would use the forEach key to execute a command for each value in the VALUES parameter:

params:
  VALUES: 2010 2011 2012 2013
steps:
  - name: task1
    forEach: $VALUES
    command: some_task $_

Also supports delimiter:

steps:
  - name: send_requests
    forEach:
      from: $INPUT_DATA
      delimiter: "---"
    executor:
      type: http
      config:
        timeout: 180
        headers:
          Accept: "application/json"
          Content-Type: "application/json"
        silent: true
        body: "$_"
    command: PUT https://some/api

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions