Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward port: Skip protobuf compatibility check for PRs to non-main #11772

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions ci/check-protobuf-stability.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,34 +89,26 @@ USAGE
exit
;;
--stable)
# Check against the most recent stable tag.
#
# This check does not need to run on release branch commits because
# they are built sequentially, so no conflicts are possible and the per-PR
# check is enough.
readonly RELEASE_BRANCH_REGEX="^release/.*"
GIT_TAG_SCOPE=""
# For PRs targeting release branches, we should really check against
# all the most recent stable tags reachable from either the current branch or
# from previous release branches (say, against both 1.17.1 and 1.16.2
# created after the release/1.17.x branch).
#
# We rather check against the most recent stable (non-snapshot) tag reachable from the current branch,
# under the assumption that if a previous release branch contains a protobuf change,
# then it will also be present in later ones (previous/later with regards to versioning).
if [[ "${TARGET}" =~ ${RELEASE_BRANCH_REGEX} ]]; then
GIT_TAG_SCOPE="--merged"
fi
readonly LATEST_STABLE_TAG="$(git tag ${GIT_TAG_SCOPE} | grep -v "snapshot" | sort -V | tail -1)"
# The v1.17 stable release includes the buf config file with the default name `buf.yml`.
# Starting with v1.18 we have multiple buf config files.
if [[ $LATEST_STABLE_TAG =~ "v1.17."* ]]; then
BUF_CONFIG_UPDATED=false
if [[ $TARGET == "main" ]]; then
# Check against the most recent stable tag.
# This check runs only on main or PRs targeting main.
#
# This check does not need to run on release branch commits because
# they are built sequentially, so no conflicts are possible and the per-PR
# check is enough.
readonly LATEST_STABLE_TAG="$(git tag | grep -v "snapshot" | sort -V | tail -1)"
# The v1.17 stable release includes the buf config file with the default name `buf.yml`.
# Starting with v1.18 we have multiple buf config files.
if [[ $LATEST_STABLE_TAG =~ "v1.17."* ]]; then
BUF_CONFIG_UPDATED=false
else
BUF_CONFIG_UPDATED=true
fi
BUF_GIT_TARGET_TO_CHECK=".git#tag=${LATEST_STABLE_TAG}"
check_protos
else
BUF_CONFIG_UPDATED=true
echo "Skipping check for protobuf compatibility because the target is '${TARGET}' and not 'main'"
fi
BUF_GIT_TARGET_TO_CHECK=".git#tag=${LATEST_STABLE_TAG}"
check_protos
;;
--target)
# Check against the tip of the target branch.
Expand Down