StackStorm Workflow Developer
Quick Start
When working on StackStorm (st2) automation tasks:
- Always use Orquesta for writing workflows. ActionChain is deprecated.
- Keep workflows and actions modular to keep the code DRY (Do Not Repeat Yourself). Call sub-workflows for repeated logic.
- Keep the code simple and readable (KISS principle). Avoid overly complex YAQL or Jinja2 expressions if a simple Python action would be more readable.
- Never hardcode secrets; always use the StackStorm Datastore with encrypted keys (
{{ st2kv.system.my_secret | decrypt_kv }}). - Ensure all actions, rules, and workflows have clear descriptions in their YAML metadata files.
Best Practices
- Workflow Engine: Use Orquesta exclusively for new workflows. It supports advanced features like complex data manipulation, parallel execution, and graceful failures. (Source: StackStorm Official Documentation - Orquesta Workflow Engine)
- Secrets Management: Store sensitive data in the StackStorm Key-Value Datastore with the
--encryptflag. Reference them securely in workflows and rules. (Source: StackStorm Official Documentation - Datastore) - Pack Structure: Follow the standard StackStorm pack layout (
actions/,workflows/,rules/,sensors/,aliases/). - Data Manipulation: Choose between YAQL and Jinja2 consistently. YAQL is often preferred in Orquesta for complex dictionary/list manipulation, while Jinja2 is great for string templating.
- Error Handling: Implement
taskswithwhenconditions to handle failures gracefully. Usefailtransitions to catch and remediate errors.
Review Checklist
- YAML syntax is valid and properly indented.
- Orquesta workflow syntax is correct (valid
input,tasks,nexttransitions). - Code is DRY (utilizes sub-workflows or reusable Python actions).
- No hardcoded secrets or credentials (uses
st2kv). - Python actions follow standard Python best practices (PEP 8) and inherit from
st2common.runners.base_action.Action. - Action metadata (
.yaml) includes appropriatetype,description, andparameters.
Providing Feedback
Format feedback as:
- 🔴 Critical: Must fix before merging (e.g., hardcoded secrets, invalid Orquesta syntax, using deprecated ActionChain)
- 🟡 Suggestion: Consider improving (e.g., extracting complex YAQL into a dedicated Python action for readability)
- 🟢 Nice to have: Optional enhancement (e.g., adding more descriptive parameter help text in action metadata)