ci: bugfix for benchmark regression reporting, after #1742

https://github.com/hasura/graphql-engine-mono/pull/1779

GitOrigin-RevId: e1769d5d6e120c23819cd7864d21e10c0ae33a54
This commit is contained in:
kodiakhq[bot] 2021-07-14 12:44:49 +00:00 committed by hasura-bot
parent 175b1a86ca
commit 719354d5b0

View File

@ -2,8 +2,12 @@
set -euo pipefail
shopt -s globstar
# This prints one or more PR numbers, in reverse history order, from the merge
# base of the branch we're on.
# The goal of this script is to help answer the question "which set of
# benchmark results should we use as the baseline performance for this branch".
# It returns a list of PR numbers, in reverse history order (in priority order)
# since the first commit might not have any associated benchmark results (e.g.
# because the benchmarks failed to run).
#
# e.g. `pr-merge-base.sh main 1` will return the PR number corresponding to the
# benchmark set we should use to measure the relative performance of the
# changes we've made in this branch.
@ -13,12 +17,18 @@ shopt -s globstar
BASE_BRANCH=$1
LIM=$2
# This is meant to be the first commit _after_ `git merge-base` since we need
# the range below to include the merge-base commit...
OUR_FIRST_COMMIT=$(git rev-list ^"$BASE_BRANCH" HEAD | tail -n 1)
# For now we ignore BASE_BRANCH and just get the list of commits with possible
# associated benchmark results from the history of this branch. These may be
# inter-mixed with changes from this branch (if the PR owner did "update
# branch"), but that doesn't matter.
#
# TODO we'd like to filter only commits from this list that are also in
# BASE_BRANCH, and also generally figure out if this can work well for PRs
# where target is not `main` (at the moment kodiak won't manage merges into
# non-protected branches anyway).
git log \
--grep='https://github.com/hasura/graphql-engine-mono/pull/[0-9]*$' \
"$OUR_FIRST_COMMIT"^@ \
-"$LIM" \
| grep -oP 'https://github.com/hasura/graphql-engine-mono/pull/\K[0-9]*$'
| grep -oP '^ https://github.com/hasura/graphql-engine-mono/pull/\K[0-9]*$'
# ^ TODO we'd also like to make this a multi-line regex so we can be sure
# these are just the kodiak-added lines