diff --git a/ci/workflows/main-cron.yml b/ci/workflows/main-cron.yml index 1c2083e1a0d4..d35803e02d75 100644 --- a/ci/workflows/main-cron.yml +++ b/ci/workflows/main-cron.yml @@ -712,6 +712,8 @@ steps: run: source-test-env config: ci/docker-compose.yml mount-buildkite-agent: true + environment: + - BUILDKITE_BRANCH - ./ci/plugins/upload-failure-logs matrix: setup: diff --git a/ci/workflows/pull-request.yml b/ci/workflows/pull-request.yml index c76589e95afd..151d5ce6ec05 100644 --- a/ci/workflows/pull-request.yml +++ b/ci/workflows/pull-request.yml @@ -711,6 +711,8 @@ steps: run: source-test-env config: ci/docker-compose.yml mount-buildkite-agent: true + environment: + - BUILDKITE_BRANCH - ./ci/plugins/upload-failure-logs matrix: setup: diff --git a/e2e_test/backwards-compat-tests/scripts/utils.sh b/e2e_test/backwards-compat-tests/scripts/utils.sh index f66e7518df2e..3f99565b9870 100644 --- a/e2e_test/backwards-compat-tests/scripts/utils.sh +++ b/e2e_test/backwards-compat-tests/scripts/utils.sh @@ -138,7 +138,10 @@ get_old_version() { # We handle the edge case where the current branch is the one being released. # If so, we need to prune it from the list. - local current_branch=$(git branch --show-current | tr -d 'v') + # We cannot simply use 'git branch --show-current', because buildkite checks out with the commit, + # rather than branch. So the current state is detached. + # Instead we rely on BUILDKITE_BRANCH, provided by buildkite. + local current_branch=$(echo "$BUILDKITE_BRANCH" | tr -d 'v') echo "--- CURRENT BRANCH: $current_branch" echo "--- PRUNED VERSIONS" @@ -147,7 +150,7 @@ get_old_version() { # Then we take the Nth latest version. # We set $OLD_VERSION to this. - OLD_VERSION=$(echo -e "$sorted_versions" | tail -n $VERSION_OFFSET | head -1) + OLD_VERSION=$(echo -e "$pruned_versions" | tail -n $VERSION_OFFSET | head -1) } get_new_version() {