StackStorm / StackStorm/st2

Wrong variable assignment in orquesta workflow

Open
#6,014 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Var doesn't get updated in Orquesta workflow

STACKSTORM VERSION

st2 3.6.0, on Python 3.8.10

OS, environment, install method

Post what OS you are running this on, along with any other relevant information/

Docker

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content
Workflow:

version: 1.0

description: A basic sequential workflow.

input:
  - name

vars:
  - greeting: {}

tasks:
  task1:
    action: dc.test
    input:
      flag: true
    next:
      - when: <% succeeded() %>
        publish: 
          - greeting: <% result().result["test"] %>
        do: task2
  task2:
    action: core.echo
    input:
      message: "All your base are belong to us!"
    next:
      - when: <% succeeded() %>
        do:
          - task3
  task3:
    action: dc.test
    input:
      flag: false
    next:
      - when: <% succeeded() %>
        publish: 
          - greeting: <% result().result["test"] %>
        do: task4
  task4:
    action: dc.test1
    input:
      ob: <% ctx().greeting %>

Action file
from st2common.runners.base_action import Action

class Test(Action):
    def run(self, flag, *args, **kwargs):
        if flag:
            return {"test": {"abc": "def"}}
        else:
            return {"test": {}}

Expected Results

In task1 we have published greeting obj as {"test": {"abc": "def"}
And in task3 we published the same greeting obj as {}

So we are expecting the greeting obj to have {} (empty dict) as the value.
But it is still having the value as {"test": {"abc": "def"}
We are assuming this is just updating the existing var/dict with the new keys when they are published and replacing existing ones with new values.

What did you expect to happen when running the steps above?

We expected an empty object assignment to greeting variable.
But it is still pointing to previously published object

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal Orquesta workflow and action example from the issue on StackStorm 3.6.0 with Python 3.8.10 in Docker. Trace how the task1 and task3 publish expressions update greeting, and consider the issue done when task4 receives the empty object from task3 rather than retaining task1's value.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.