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

Add global step templates #46

Open
JeanMertz opened this issue Aug 25, 2019 · 2 comments
Open

Add global step templates #46

JeanMertz opened this issue Aug 25, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@JeanMertz
Copy link
Contributor

Once the list of tasks grows, you get a lot of copy/pasting of commonly-used steps, such as this one:

steps:
  - name: Validate Customer UUID
    description: |-
      Validate the customer UUID format as UUIDv4.
    processor:
      stringRegex:
        input: '{{ var["Customer UUID"] }}'
        regex: >-
          \A[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}\z
        mismatchError: The provided customer UUID has an invalid format.

  - name: Other Step
    ...

It would be nice if there was some kind of (optional) feature that allows you to define global steps (somewhat similar to global variables #24) that can be shared across tasks.

For starters, such a step could be used as:

steps:
  - template: Validate Customer UUID
  - name: Other Step
    ...

The concept would probably be based on inheritance. You can define a template key to inherit any properties set in that template, and then override what you need changed in your own task.

There are still plenty of design decisions to make, and gotchas to consider, but the general concept of this is very useful for larger Automaat instances.

@JeanMertz
Copy link
Contributor Author

Another approach to inheritance would be to allow step templates to define their own required arguments, so that a template can be configured on a per-need basis, for example:

steps:
  - template:
      id: Regex String Validation
      config:
        name: Validate Customer UUID
        regex: ... 
  - name: Other Step
    ...

But, this would make things way more complex, for probably too little gain. Just putting this out there as a possibility, but I'm not a big fan of this over the inheritance approach.

@JeanMertz
Copy link
Contributor Author

One case that could be made against this feature is that there is nothing preventing someone running their own Automaat instance from using their own pre-processing system to inject these steps based on their own needs.

For example, if you have your own my_task.yml, you could pre-process that file before using its definition to trigger the Automaat API calls to create the task, and inject pre-defined steps from some other file based on some templating strings such as {{ include "my pre-defined step" }}.

That would keep Automaat itself simpler, but still provide the same result, I believe.

@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