Document how to evaluate two variables#240
Document how to evaluate two variables#240diegolovison wants to merge 1 commit intoHyperfoil:masterfrom
Conversation
| - read-state: ${{= ${{abort_on_failure:true}} && "${{START_JOB_RESULT:}}" !== 'SUCCESS' }} | ||
| then: | ||
| - sh: echo Failure | ||
| else: | ||
| - sh: echo Success |
There was a problem hiding this comment.
Instead of using read-state, isn't better using js directly to evalute boolean expressions?
- js: ${{abort_on_failure:true}} && "${{START_JOB_RESULT:}}" !== 'SUCCESS'
then:
- sh: echo Failure
else:
- sh: echo Success
I remember @willr3 mentioned this in the past, therefore I'd like to get his advice here 😄
There was a problem hiding this comment.
Yes that information came from him
There was a problem hiding this comment.
To get it working as you are proposing I think you are missing a regex, am I right?
- read-state: ${{= ${{abort_on_failure:true}} && "${{START_JOB_RESULT:}}" !== 'SUCCESS' }}
- regex: true
then:
- sh: echo Failure
else:
- sh: echo SuccessThere was a problem hiding this comment.
both work, a boolean operation probably makes more sense as a js command because it means we no longer need the regex but I think having both examples is useful. Perhaps we steer users toward js but show that it can also be accomplished in read-state?
There was a problem hiding this comment.
We can document how to do it with JavaScript as well. WDYT?
There was a problem hiding this comment.
I think that's a good idea
Document how to evaluate two variables