StackStorm / StackStorm/st2

Orquesta - ChatOps - Duplicate chatops.post_result tasks triggered

Open
#5,166 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug chatops status:to be verified workflows: orquesta
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Orquesta worflow execute post_message twice when one task is failed. Possibly related to https://github.com/StackStorm/st2/issues/4362

STACKSTORM VERSION

st2 3.3.0, on Python 3.6.12

OS, environment, install method

Ubuntu 20.04.2 LTS
Custom install from official repo:
deb https://packagecloud.io/StackStorm/stable/ubuntu/ bionic main

Steps to reproduce the problem

Simple workflow to reproduce problem:

---
version: 1.0

description: Update AWS Parameter Store

vars:
  - task_message: null
  - stdout: null
  - stderr: null

output:
  - task_message: <% ctx().task_message %>
  - stdout: <% ctx().stdout %>
  - stderr: <% ctx().stderr %>

tasks:
  main:
    action: core.noop
    next:
      - when: <% succeeded() %>
        publish:
          - task_message: "main ok"
        do:
          - test
          - notify_slack
      - when: <% failed() %>
        publish:
          - task_message: "main failed"
          - stderr: <% result().stderr %>
        do:
          - notify_slack

  test:
    action: core.noop
    next:
      - when: <% succeeded() %>
        publish:
          - task_message: "test ok"
        do:
          - test2
          - notify_slack
      - when: <% failed() %>
        publish:
          - task_message: "test failed"
          - stderr: <% result().stderr %>
        do:
          - notify_slack

  test2:
    action: core.local cmd="exit 0"
    next:
      - when: <% succeeded() %>
        publish:
          - task_message: "test2 ok"
          - stdout: <% result().stdout %>
        do:
          - test3
          - notify_slack
      - when: <% failed() %>
        publish:
          - task_message: "test2 failed"
          - stderr: <% result().stderr %>
        do:
          - fail
          - notify_slack

  test3:
    action: core.local cmd="exit 1"
    next:
      - when: <% succeeded() %>
        publish:
          - task_message: "test3 ok"
          - stdout: <% result().stdout %>
        do:
          - notify_slack
      - when: <% failed() %>
        publish:
          - task_message: "test3 failed"
          - stderr: <% result().stderr %>
        do:
          - fail
          - notify_slack

  notify_slack:
    action: core.local cmd="echo 123 >> /tmp/debug.log"
    next:
      - when: <% succeeded() %>
        publish:
          - task_message: <% ctx('task_message') %>
          - stdout: <% ctx('stdout') %>
          - stderr: <% ctx('stderr') %>

Expected Results

Have only one result in slack with execution success/failure

Actual Results

Have 2 messages in slack.
It doesn't depend on -fail parameters count. You can fail all tasks or only one - you'll get exactly two chatops.post_result executions: https://prnt.sc/1069gou
I check both execution details, and there's no difference except end_timestamp, occurrence_time and id fields

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

Use the supplied Orquesta workflow as the reproduction case, then inspect how its failed-task transitions trigger chatops.post_result. Compare the two execution details, especially their timing and identifiers, and verify the workflow produces only one Slack result after the fix. No source file or test path is named in the issue.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.