Manual fail of task #430
Answered
by
yohamta
Narsimha1997
asked this question in
Q&A
-
I want to fail task when the command successfully executed and based on the output of the script. |
Beta Was this translation helpful? Give feedback.
Answered by
yohamta
Apr 12, 2023
Replies: 1 comment
-
Hi @Narsimha1997 👋 One possible way to accomplish this is with the following YAML code: steps:
- name: s1
command: echo valid
output: RESULT
- name: s2
command: "sh"
script: |
echo result=$RESULT
if [ "$RESULT" != "valid" ]; then
exit 1
fi
depends:
- s1 I was thinking that it would be great to add more versatile condition capabilities, such as the ability to specify preconditions like the one in this example where we check if the result is not equal to "valid". steps:
- name: s1
command: echo valid
output: RESULT
- name: s2
command: "false" # fail
preconditions:
- condition: "$RESULT"
predicate: "!="
expected: "valid"
depends:
- s1 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Narsimha1997
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Narsimha1997 👋
One possible way to accomplish this is with the following YAML code:
I was thinking that it would be great to add more versatile condition capabilities, such as the ability to specify preconditions like the one in this example where we check if the result is not equal to "valid".