StackStorm / StackStorm/st2

Multiple Policies to Govern a single Action/Workflow

Open
#6,310 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

I've noticed that it's not possible to have multiple policies for a single action/workflow. This is something that would be really useful. Imagine a workflow that has a user and host input, token example. I'd like to be able to do something like:

policies/my_action_hosts.yaml

name: my_pack.my_action.host.concurrency
description: control concurrency of `my_action` by host
resource_ref: my_pack.my_action
parameters:
  action: cancel
  threshold: 1
  attributes:
    - hosts

policies/my_action_user.yaml

name: my_pack.my_action.host.concurrency
description: control concurrency of `my_action` by host
resource_ref: my_pack.my_action
parameters:
  action: cancel
  threshold: 5
  attributes:
    - user

@cognifloyd @nzlosh do y'all think this is something that might be useful? I'd be interested in contributing to it, if it's possible. Would need to get a dev environment for st2 proper set up.

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

The issue names policy YAML files for a single action/workflow and separate host and user attributes, but no source files or tests. Set up a st2 development environment, find the policy-loading and enforcement entry points, and trace how one resource reference is handled. Done means multiple policies can govern one action/workflow with their own thresholds and attributes, with tests covering the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.