ChatOps: Action Alias - BitBucket / Terraform

(LuisN) #1

Question is, are there any Action Alias’ already created for these packs? I am not the best with RegEx (trying to freshen up) but tried to use the example run.cmd but wondered if I can analyze a more in-depth one out there to learn against


Nope, neither of those packs contain ChatOps aliases (neither of those repositories has an aliases directory).

You can see examples of aliases in the st2 pack, here:

Or the PagerDuty pack:

Also note that you aren’t required to use regexes when you write aliases - you can also use the Jinja-esque formatting:

    - "st2 list {{ limit=10 }} actions"
    - "st2 list {{ limit=10 }} actions from {{ pack }}"

(LuisN) #3

@blag you are the best, checking it out!

(LuisN) #4

Easy peasy, last q where can i find out the variables used for bb or etc? example {{ }} wont work.

(LuisN) #5

Should really add the example

name: "list_repos"
pack: "bitbucket"
action_ref: "bitbucket.list_repos"
description: "Return a list of BitBucket Repoes"
  - "st2 bitbucket.list_repos"
  format: |
    {% if execution.status == "succeeded" %}
      {% for item in execution.result.result %}
        ---> stdout: {{execution.result.result}} 
    #{{ }} is '{{ item.status }}': Title '{{ item.title }}'
      {% endfor %}
    {% else %}
      {% if execution.result.stderr %}*Stderr:* ```{{ execution.result.stderr }}```{% endif %}
    {% endif %}


        ---> stdout: {{execution.result.result}} 

Worked, but going to read up how to grab each item / key value and a better format

(LuisN) #6

Nice got this working
— Bucket: {{}}
format is a bit off but works.


You can create a PR for the stackstorm-bitbucket project with that alias. That would help other StackStorm users as well.