about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rwxr-xr-xnix/buildkite/fetch-parent-targets.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/nix/buildkite/fetch-parent-targets.sh b/nix/buildkite/fetch-parent-targets.sh
index d34a826279d0..9a8fecd1f460 100755
--- a/nix/buildkite/fetch-parent-targets.sh
+++ b/nix/buildkite/fetch-parent-targets.sh
@@ -15,12 +15,14 @@ set -ueo pipefail
 
 : ${DRVMAP_PATH:=pipeline/drvmap.json}
 
-function most_relevant_builds {
-    git fetch -v origin "${BUILDKITE_PIPELINE_DEFAULT_BRANCH}"
-    local FIRST=$(git merge-base --fork-point HEAD FETCH_HEAD)
-    local SECOND=$(git rev-parse "$FIRST~1")
-    local THIRD=$(git rev-parse "$FIRST~2")
+git fetch -v origin "${BUILDKITE_PIPELINE_DEFAULT_BRANCH}"
+
+FIRST=$(git merge-base --fork-point FETCH_HEAD "${BUILDKITE_COMMIT}")
+SECOND=$(git rev-parse "$FIRST~1")
+THIRD=$(git rev-parse "$FIRST~2")
 
+function most_relevant_builds {
+    set -u
     curl 'https://graphql.buildkite.com/v1' \
          --silent \
          -H "Authorization: Bearer $(cat /run/agenix/buildkite-graphql-token)" \