Skip to content

Orquesta - ChatOps - Duplicate chatops.post_result tasks triggered #5166

Open
@NikonNLG

Description

@NikonNLG

SUMMARY

Orquesta worflow execute post_message twice when one task is failed. Possibly related to #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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions