How can I use variables stored with envman in the run_if check before a step is run?

Hi @viktorbenei,

I was able to get past my issue, thank you for confirming that this is possible. To give you more context, this is the scenario that was not working for me:

workflow_test:
    steps:
    - script@1.1.5:
        is_always_run: true
        inputs:
        - content: |-
            echo 0 | envman add --key TEST_ENV       
    - script@1.1.5:
        is_always_run: true
        run_if: '{{getenv "TEST_ENV" | eq "0"}}'
        inputs:
        - content: |-
            echo "Test!!"

The second script would never be called, and I would always see the output:

WARN[16:35:01] The step's (script@1.1.5) Run-If expression evaluated to false - skipping
INFO[16:35:01] The Run-If expression was: {{getenv "TEST_ENV" | eq "0"}}

All I had to do was to change the way I was setting the TEST_ENV to the following:

envman add --key TEST_ENV --value 0

and the second script would run and I would see Test!! printed.

Iā€™m sure this is a case of me not understanding what BASH is doing behind the scenes here, but wanted to provide the solution that worked for me.

Thanks again @viktorbenei!

2 Likes