(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

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

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

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

  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!

Thanks,

Air

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