Conditional (block) step

Hi @tfrokt!

Thanks for checking with us!

We can check the outcome of the “Sanity check” step and then dynamically upload a block step based on the result of the ‘Sanity check’. We also need to soft_fail the ‘Sanity check” step, so it continues to run the remaining steps in the pipeline even when it fails.

A sample pipeline would be like this:

steps:
  - command: exit -1
    key: "sanity-check"
    soft_fail: 
      - exit_status: "*"
  - wait: ~
  - command : |
      if [ $$(buildkite-agent step get "outcome" --step "sanity-check") == "soft_failed" ]; then
         cat <<- YAML | buildkite-agent pipeline upload
         steps:
           - block: "sanity is failed. check and unblock me."
      YAML
      fi
  - wait: ~
  - command: echo "running regression"

Some useful info on the insertion order when using dynamic upload: Steps are inserted immediately following the job performing the pipeline upload. Note that if you perform multiple uploads from a single step, they can appear to be in reverse order, because the later uploads are inserted earlier in the pipeline.

Hope this helps solve your use case!

Let us know for any questions!

Best,
Nithya