about summary refs log blame commit diff
path: root/ops/pipelines/static-pipeline.yaml
blob: c864aea65714181e0e86859ff8b6e6896433e000 (plain) (tree)
1
2
3
4
5




                                                                      









                                                                   
                                                                             
                                                            











                                                                 
                                                                           
                                                                             
# This file defines the static Buildkite pipeline which attempts to
# create the dynamic pipeline of all depot targets.
#
# If something fails during the creation of the pipeline, the fallback
# is executed instead which will simply report an error to Gerrit.
---
steps:
  - label: ":llama:"
    command: |
      function fallback() {
        echo 'Using fallback pipeline ...'
        buildkite-agent pipeline upload ops/pipelines/fallback.yaml
        exit
      }

      nix-build -A ops.pipelines.depot -o depot.yaml --show-trace || fallback
      buildkite-agent pipeline upload depot.yaml || fallback

  # Create a revision number for the current commit for builds on
  # canon.
  #
  # This writes data back to Gerrit using the Buildkite agent
  # credentials injected through a git credentials helper.
  #
  # Revision numbers are defined as the number of commits in the
  # lineage of HEAD, following only the first parent of merges.
  - label: ":git:"
    if: "build.branch == 'refs/heads/canon'"
    command: |
      git -c 'credential.helper=/etc/secrets/buildkite-credential-helper' \
        push origin "HEAD:refs/r/$(git rev-list --count --first-parent HEAD)"