(Orquesta Workflow) JSON, Actions & Items()

Hi Everyone,

I’m attempting to iterate a list containing JSON items, then pass each entry to the next action:

version: 1.0
description: A workflow which will create JIRA tickets based on PromQL Queries

  - url
  - query
  - severity
  - type
  - project
  - query_description
  - query_title
  - summary

  - jiraID: null
    action: prometheus.query url=<% ctx(url) %> query=<% ctx(query) %>
      - when: <% task(init_query).result.result.data.result %>
          - stdout: <% result().stdout %>
          - stderr: <% result().stderr %>
          - json: <% task(init_query).result.result.data.result.metric %>
        do: search_jira

      items: <% ctx(json) %>
      concurrency: 1
         action: core.echo message=<% item().get(device_name,None) %>
      - when: { trimmed }
          - stdout: <% result().stdout %>
          - stderr: <% result().stderr %>
		  - json2: <% item() %>
        do: create_jira

    action: core.echo message=<% ctx(json2) %>

Is this possible using YAQL/Orquesta? “item()” is correct in the task “search_jira”, however, I’m unable to find a method of having it recognized in the following “create_jira” (using item(), assigning item() to json2, inputs, publish etc.). Help would be greatly appreciated!



Question was answered in Slack:

It’s not possible to pass items between actions, and requires a second workflow to be called.

But why? This seems like such a basic function that that other template languages can do.

Mistral had the notion of a workbook that could contain multiple workflows, with a main workflow being used to start execution. When invoking with-items, it was possible to call a sub-workflow that would allow executing a group of actions per iteration of with-items.

Orquesta doesn’t have the notion of a workbook. Each workflow is a single workflow, which means that if you wish to iterate of a set of items that require more than 1 action to process it, you need to call another workflow, which will be an external workflow.

1 Like