Skip to content

Manual fail of task #430

Answered by yohamta
Narsimha1997 asked this question in Q&A
Discussion options

You must be logged in to vote

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: "!="

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Narsimha1997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants