Skip to content

Commit

Permalink
Merge #122209
Browse files Browse the repository at this point in the history
122209: pre-push: augment logic r=rail,jlinder a=rickystewart

* Don't suggest pushing with `--no-verify` for `release-` branches, `staging`, `trying`: we shouldn't give anyone ideas.
* Suggest using the `custombuild-` prefix.
* Warn about deleting the branch as soon as possible

Part of: DEVINF-1082

Epic: None
Release note: None

Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
craig[bot] and rickystewart committed Apr 18, 2024
2 parents 5f83525 + 802fb1f commit d9e7a6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ set -uo pipefail
# deny push of a head but not a tag to cockroachdb/cochroach ssh and http URLs.
while read local_ref local_sha remote_ref remote_sha
do
if [[ "$remote_ref" == "refs/heads/"* ]] && [[ "$2" == *"cockroachdb/cockroach"* ]]; then
if [[ "$remote_ref" == "refs/heads/"* ]] && [[ "$2" == *"cockroachdb/cockroach"* ]] && [[ "$remote_ref" != "refs/heads/blathers/backport-"* ]]; then
echo "Refusing to push to $remote_ref on $2."
echo "Push your branch to your own fork and open a PR from there."
echo "If you just want to see what CI thinks, you can push branch:refs/ci/branch to trigger a CI run."
echo "If this is an emergency or unusual circumstance that requires a branch on origin, push with --no-verify."
if [[ "$remote_ref" != "refs/heads/release-"* ]] && [[ "$remote_ref" != "refs/heads/staging" ]] && [[ "$remote_ref" != "refs/heads/trying" ]]; then
echo "If this is an emergency or unusual circumstance that requires a branch on origin, push with --no-verify."
fi
if [[ "$remote_ref" != "refs/heads/custombuild"* ]]; then
echo "Consider using the prefix custombuild- for your branch name to help distinguish this branch from legitimate release branches."
fi
echo "If you push a branch to origin, delete it as soon as possible."
exit 1
fi
done
Expand Down

0 comments on commit d9e7a6a

Please sign in to comment.