Skip to content

Commit

Permalink
fix(test): fix current_branch for backwards compat test (#18565)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Sep 17, 2024
1 parent 2b9280f commit 3b3dda7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ci/workflows/main-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions ci/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions e2e_test/backwards-compat-tests/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down

0 comments on commit 3b3dda7

Please sign in to comment.