Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use notify with orquesta workflow and jinja expression support? #138

Open
sahilsk opened this issue Mar 13, 2019 · 7 comments
Open

Comments

@sahilsk
Copy link

sahilsk commented Mar 13, 2019

Issue: Not able to notify in slack channel with workflow output/stdout. How to use workflow context and variable in notify parameter, without writing for each of the task in the workflow

Workflow-meta.yaml

---
description: A Nessus scanner reporter validator workflow
enabled: true
runner_type: orquesta
entry_point: workflows/nessus_report_validation_workflow.yaml
name: nessus_report_validation_workflow
pack: st2pack_poc
notify:
  on-complete:
    routes:
      - slack
    message: "Action has finished"
  on-success:
    routes:
      - slack
    message: "Succeeded: {{action_results.stdout}}"
  on-failure:
    routes:
      - slack
    message: |
     Yikes!! It failed. {{ stdout }} {{ result().stdout }} <% ctx() %> <% result().issue_key %>  <% stdout %>!!
parameters:
...

Slack channel output:

image

@m4dcoder
Copy link
Collaborator

Currently, there is already a notify parameter that can be specified in st2 action execution to specify which task to notify on. An example is located at https://github.com/StackStorm/st2/blob/master/st2tests/st2tests/fixtures/packs/orquesta_tests/actions/notify.yaml. However, it does not work the way you specified here to notify on certain conditions and what channel to notify on and with what message. We will mark this as a feature request at this point in time as we're trying to get the current scope into GA for st2 v3.0. If you do not hear from us, please ping us again about this feature. Thanks.

@sahilsk
Copy link
Author

sahilsk commented Mar 14, 2019

@m4dcoder thanks for looking into it.

well that's a very unpredictable syntax. Which route? which notify trigger will it choose?
Unfortunately this syntax didn't work on my v2.10.3 setup. I have chatops n slack: both configured correctly.
The old schema was working in the action-chain and thought all other workflows:mistra, orquesta will also honor it. We should have more consistent behavior across all workflow engines to have more coherent and delightful user experience.

To solve my problem, I had to write custom notify action in the workflow.

@moet78
Copy link

moet78 commented Aug 9, 2019

It is now 3.1.0. Is there a way to specify format for orquesta notify yet?

@m4dcoder
Copy link
Collaborator

m4dcoder commented Aug 9, 2019

@moejarv You can use this example at https://github.com/StackStorm/st2/blob/master/st2tests/st2tests/fixtures/packs/orquesta_tests/actions/notify.yaml to specify a simple notify for the list of tasks that you want to get notification on. As for the original request in this issue, it's still open.

@moet78
Copy link

moet78 commented Aug 9, 2019

I also need either jinja 2 or yaql to help with formatting. Guess I need to try find out how to write custom notify action then.

@Kami
Copy link
Member

Kami commented Apr 17, 2020

I'm having issues with getting notify parameter to work.

Even if I specify to notify on a single task, I still see multiple core.st2.generic.notifytrigger triggers getting dispatched which results in multiple notifications.

I didn't have too much time to dig in yet, but once I do, I will open a new issue with some additional context.

Basically, what I wanted to achieve is to only notify on the whole workflow failure (not on sub tasks).

I tried to achieve that by specifying "notify" parameter and setting the default value to a dummy task which is never called.

Even when doing that, I see multiple notifications being triggered when a single task in a workflow fails, which makes it looks like this parameter is not being used or similar.

@daBONDi
Copy link

daBONDi commented Apr 22, 2020

Trip on it today, relay need it, it makes orquesta useless for us, only workaround is to write manual actions all over the place :-(

Also issue with trigger 2 notification with a single task also happen on me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants