1. Resources
  2. /
  3. Changelog
  4. /
  5. Simpler conditional notifications for failing steps

Simpler conditional notifications for failing steps

Customers often need to send custom slack or email notifications when steps fail. If an important build or deploy step fails, then someone needs to know about it. But, this hasn't been the simplest process until now.

You can now reference a step's information (id, key, label, type, state and outcome) in conditionals by prefixing with step. (such as step.id). This is particularly useful when you need to notify someone as soon as a step fails. See detailed descriptions of these values in our docs on conditional variables.

Here's how simple it is now:

1
2
3
4
5
6
7
8
steps:
  - command: false
    notify:
      - slack:
          channels: ["#engineering"]
          if: step.outcome == "hard_failed"
          message: "Important step failed, please fix."
  - command: sleep 1000

Previously, the recommended solution required conditionally uploading a new step to handle notifications:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
steps:
  - label: "Fail"
    command: exit 1
    key: "fail"
  - label: "Run regression only if fail check is failed"
    depends_on: "fail"
    command: |
      if [ $$(buildkite-agent step get "outcome" --step "fail") == "hard_failed" ]; then
         cat <<- YAML | buildkite-agent pipeline upload
         steps:
           - label: notify"
             command: notification.sh
      YAML
      fi

For quick reference, options for step.outcome are neutral, passed, errored, hard_failed or soft_failed. step.state can be one of ignored, waiting_for_dependencies, ready, running, failing or finished. step.type exposes the step's type such as command or trigger. Step key and label are user defined values.

This new syntax works with all notification types (Slack, email, webhooks, etc.) and can be combined with other conditions using standard operators (&&, ||). Each step's notification can only reference its own outcome - you can't reference other steps' outcomes directly in the notification conditional.

Notifications are sent immediately when the step completes with the specified outcome, providing faster feedback when issues occur.

Chris

Start turning complexity into an advantage

Create an account to get started with a 30-day free trial. No credit card required.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Pipeline templates
  3. Public pipelines
  4. Test Engine
  5. Package Registries
  6. Mobile Delivery Cloud
  7. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Webinars
  5. Plugins
  6. Case studies
  7. Events

Company

  1. About
  2. Careers
  3. Press
  4. Brand assets
  5. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for AI/ML
  3. Testing at scale
  4. Monorepo mojo

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2025