tvl-depot/ops/pipelines/static-pipeline.yaml
Vincent Ambo 099f36e5ee fix(ops/pipelines): Fix tagging of commit revisions
It seems that shell variables don't work as expected inside the
Buildkite pipeline, so usage of variables has been removed.

We also don't echo the revision anymore because of that, but it does
still appear in the log of `git push`.

Change-Id: I124e3b09af896da898f2a78715ed371651a1c5f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3780
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2021-11-06 00:33:23 +00:00

32 lines
1.2 KiB
YAML

# 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 meta-data set 'failure' '0'
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)"