Mistral workflow


(Peter Michael Gits) #1

Trying to figure out how to call a mistral workflow from within an action within a mistral workflow. Think of them as nested. Can you point me to a sample which effectively allows me to build up mistral workflows?

Thanks in advance,

Peter M. Gits


#2

Our st2_e2e_tests workflow demonstrates this for you.

TL;DR:

---
version: '2.0'
name: st2cd.st2_e2e_tests
description: Run the suite of end to end tests on the st2 host

workflows:
    main:
        type: direct
        input:
            # ...

        tasks:
            init:
            # ...
            run_basic_tests:
                workflow: test_basic
                input:
                    # ...
            run_quickstart_tests:
                workflow: test_quickstart_wf
                input:
                    # ...
                on-success:
                    # Run Mistral tests after basic and quickstart
                    - run_mistral_tests
            run_mistral_tests:
                workflow: test_mistral
                input:
                    # ...
                on-success:
                    - run_inquiry_tests
            run_inquiry_tests:
                workflow: test_inquiry
                input:
                    # ...
                on-success:
                    - run_windows_tests
            run_windows_tests:
                workflow: test_windows
                input:
                    # ...
                on-success:
                    - enterprise_tests: <% $.enterprise %>
            enterprise_tests:
               action: st2cd.st2_enterprise_tests
               input:
                    # ...

    test_basic:
        type: direct
        input:
            # ...
        tasks:
            # ...

    test_quickstart_wf:
        type: direct
        input:
            # ...
        tasks:
            # ...
    test_mistral:
        type: direct
        input:
            # ...
        tasks:
            # ...
    test_inquiry:
        type: direct
        input:
            # ...
        tasks:
            # ...
    test_windows:
        type: direct
        input:
            # ...
        tasks:
            # ...

Just keep in mind that Mistral will be deprecated in StackStorm 3.0 and replace by Orquesta, which does not (yet, and possibly never will) support specifying subworkflows like this.

That workflow has actually been broken up into a few different Orquesta workflows:


(Peter Michael Gits) #3

So, enterprise_tests:
action: st2cd.st2_enterprise_tests is the one that calls out the the external action defined elsewhere. Thanks for the clarification. Is St2cd an available package to install into packs? I haven’t seen it before…

Thanks for the quick turnaround!

Cheers,

Peter M. Gits


#4

Yes, workflows are types of actions - they are literally actions that are run by the specified workflow engine.

You can install the st2cd pack, it’s just not available on exchange. However, it may not be that useful for you, since it is used internally for our CI/CD workflows.

It would be a good pack to learn from.

You can install it directly from GitHub with st2 pack install https://github.com/StackStorm/st2cd.git.