From a3289a339d17e781afa09c4589935bbdd98a3b63 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 14 Feb 2024 13:54:02 +0100 Subject: [PATCH] [Ops] fix emergency release pipeline to work in Buildkite env (#176906) The old code expected the branch to be available locally. If it wasn't it would fail. With this change, it now runs the commands "against" the remote repository instead, so it shouldn't matter what's available locally. --- .../scripts/serverless/create_deploy_tag/create_fix_tag.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/scripts/serverless/create_deploy_tag/create_fix_tag.sh b/.buildkite/scripts/serverless/create_deploy_tag/create_fix_tag.sh index ed1fab966ac49..ac302f43c9599 100755 --- a/.buildkite/scripts/serverless/create_deploy_tag/create_fix_tag.sh +++ b/.buildkite/scripts/serverless/create_deploy_tag/create_fix_tag.sh @@ -2,14 +2,14 @@ set -euo pipefail -echo "--- Verify $BUILDKITE_COMMIT exists in $BUILDKITE_BRANCH" +echo "--- Verify $BUILDKITE_COMMIT exists in origin/$BUILDKITE_BRANCH" # Step 1: Check if the commit is in the specific named branch -if git merge-base --is-ancestor $BUILDKITE_COMMIT $BUILDKITE_BRANCH; then +if git merge-base --is-ancestor $BUILDKITE_COMMIT origin/$BUILDKITE_BRANCH; then echo "Commit $BUILDKITE_COMMIT is part of the $BUILDKITE_BRANCH branch" # Step 2: Check if the commit is also part of any other branches # This command lists all branches containing the commit and counts them - branches_containing_commit=$(git branch --contains $BUILDKITE_COMMIT | wc -l) + branches_containing_commit=$(git branch -r --contains $BUILDKITE_COMMIT | wc -l) # If the commit is in more than one branch, exit with non-zero if [[ $branches_containing_commit -gt 1 ]]; then