What are supported values for step attribute - "outcome"?

I’m trying to grab the outcome for the previous step in the pipeline via: buildkite-agent step get “outcome”. Is “passed” the only possible value for attribute “outcome”? I couldn’t find list of supported values anywhere - “outcome” as an attribute is also not mentioned anywhere.

Hey @jayarjo, great question and welcome! :tada:

You are correct, it looks like we need to update that documentation to include the ‘outcome’ value and it could really use an example also. I have raised this with our docs team so we can fix that!

We do have some documentation here buildkite-agent step v3 | Buildkite Documentation and you can also take a peek at the code agent/step_get.go at 3c23d4fba201d418974073ecaf7c7010fffd67e8 · buildkite/agent · GitHub.

I put together an example for you.

Here we are looking for the failure (hard_failed as opposed to soft_failed) and you could also check on ‘passed’ as you mentioned. As you will have noticed, you will need to use a step key to identify it:

steps:
  - label: 'Step 1'
    command: "false"
    key: 'one'
  
  - wait:
    continue_on_failure: true
    
  - label: 'Step 2'
    command: |
      if [ $$(buildkite-agent step get "outcome" --step "one") == "hard_failed" ]; then
        buildkite-agent annotate 'this build failed' --style 'error'
      fi