Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Add support for conditional steps #44

Open
JeanMertz opened this issue Aug 21, 2019 · 0 comments
Open

Add support for conditional steps #44

JeanMertz opened this issue Aug 21, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@JeanMertz
Copy link
Contributor

I haven't thought this through yet, but I've come across some real-world cases that would've benefited from conditional steps.

It would add more complexity to the system, so it's still debatable if the trade-offs are worth it.

As for if we were to do this, the cases I've seen require some way to determine "if the output of step A matches value B, then run this step".

So something like:

steps:
  - name: Step A
    description: ...
    processor:
      printOutput
        output: "hello"

  - name: Step B
    conditional: '{{ output["Step A"] == "hello" }}true{{ endif }}'
    description: ...
    processor:
      printOutput
        output: "world"

Basically, if the conditional field is anything other than a blank string, the step will run. This allows for using the existing templating support (#23) to decide if a step should run.

We'd probably also want to add a Skipped state to the existing step states enum, to make it clear if a step ran or not.

But again, this is very preliminary, we'll see if this really makes things easier, instead of too complex to work with.

To give one example that I came across (with some fictional details):

  1. A task takes a variable X, that variable can be a URL to either a post, or a user page
  2. if it's a user page, fetch the url to the latest post, then go to step 3, otherwise skip this step
  3. fetch the post details
@JeanMertz JeanMertz added the enhancement New feature or request label Aug 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant