StackStorm / StackStorm/st2

Dynamic variable resolution in array parameter

Open
#4,970 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

SUMMARY

I have an action workflow which at some point installs a pack:

 - name: "echo_var"
    ref: "core.local"
    parameters:
      cmd: "echo {{ work_dir }}/{{ extract_project_name.result[\"project_name\"] }}"
    on-success: "install_pack"
    on-failure: "remove_folder"
 - name: "install_pack"
    ref: "packs.install"
    parameters:
      packs:
        - "file:/{{ work_dir }}/{{ extract_project_name.result[\"project_name\"] }}/{{ pack_location_relative_path }}"
    on-failure: "clean_up"

I recon within the array-string the extract_project_name.result[\"project_name\"] is not resolved, leading to an erroneous input for the install_pack step.
As a result the step is not executed at all, I don't even see traces of invocation. The previous action (echo_var) works just fine, and resolves the variable perfectly.
After this the execution continues with the remove_folder step (as pointed to by the echo_var step.

Note that this

STACKSTORM VERSION

st2 3.1.0, on Python 3.6.9:

OS, environment, install method
  • Ubuntu 18.04.4 LTS
  • one-line install (curl -sSL https://stackstorm.com/packages/install.sh | bash -s -- --user=st2admin --password='Ch@ngeMe')

Steps to reproduce the problem

  • Create a basic python action, which returns an object (such as {"message": "somemessage}) and then try to use its result in the action chain as described above.

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

Reproduce the action-chain workflow with a basic Python action returning an object, then trace dynamic variable resolution for the array-valued packs parameter. Compare it with the working scalar cmd parameter and verify that the resolved pack path reaches the install_pack step without triggering on-failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.