StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.09k stars 747 forks source link

Support Dynamic Enums in the Actions UI #5400

Open cydergoth opened 3 years ago

cydergoth commented 3 years ago

Rundeck allows for an input type using a dynamically generated enum, e.g. list of kubernetes clusters. It would be nice to see an equivalent in ST2

rush-skills commented 3 years ago

@armab I also like this proposal and can help in contributing it (if I get enough understandings of the internals 😅) I think it will need adding a new type of field for actions or adding some new meta for enum fields to allow them to read the keys from a specified key in a KV store.

This also helps put a required check with values validated by this list as a source of truth, instead of checking and failing later.

Not sure how the pagination/search would work though since it might need some more changes in the get actions call or another endpoint in API to give paginated search results (for a given key or is it a subset of action API? Is that something that is needed anywhere else?).

An action can then be written by the user to update the list and put rules to run the update as they deem.

I do want to question if putting such 10k node lists in the KV store is a good idea/recommended?

cydergoth commented 3 years ago

Some good thoughts there. I was envisioning a new service on the API server to call a new type of user defined object, like an action but designed to pull values for the forms. That could also be extended to validate values before submit.

cydergoth commented 3 years ago

Grafana does a good job of this too.

cyberkov commented 2 years ago

I am not entirely sure whether it's worth its own issue or belongs to this one, but it would alse be great to load enums with data from the configuration. For instance the "sql" or the "foreman" pack do hold configuration for connections in a hash, whose keys would be perfect to be used in the given actions enums. I imagine it to be something like:

connections:
  production:
    drivername: mysql
    host: "db01"
    username: "stackstorm"
    password: "foobar"
    database: "st2"
parameters:
  connection:
    type: enum
    description: "Name of <connection> from this pack's configuration that specifies how to connect to a database server."
    required: false
    default:  '{{ config_context.connections | keys }}'