about summary refs log tree commit diff
path: root/ops/ci/pipeline.yml
blob: 4308f6a0f4ea15ddbb6b76afa7f773ba2877b43b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
env:
  BUILDKITE_TOKEN_PATH: /run/agenix/buildkite/graphql
steps:
  - label: ":shell:"
    command: "nix develop -c pre-commit run --all-files"

  # wait for all previous steps to complete.
  - wait: null
    continue_on_failure: true

  - label: ":hammer:"
    command: |
      set -ueo pipefail

      readonly FAILED_JOBS=$(curl 'https://graphql.buildkite.com/v1' \
        --silent \
        -H "Authorization: Bearer $(cat ${BUILDKITE_TOKEN_PATH})" \
        -d "{\"query\": \"query BuildStatusQuery { build(uuid: \\\"$BUILDKITE_BUILD_ID\\\") { jobs(passed: false) { count } } }\"}" | \
        jq -r '.data.build.jobs.count')

      echo "$$FAILED_JOBS build jobs failed."

      if (( $$FAILED_JOBS > 0 )); then
        exit 1
      fi