3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
16 # Please do not run this script without talking to the Neutron PTL. Auto
17 # abandoning people's changes is a good thing, but must be done with care.
19 # before you run this modify your .ssh/config to create a
20 # review.openstack.org entry:
22 # Host review.openstack.org
23 # User <yourgerritusername>
27 # Note: due to gerrit bug somewhere, this double posts messages. :(
29 # first purge the all reviews that are more than 4w old and blocked by a core -2
31 if [ "$1" = "--dry-run" ]; then
32 echo "Enabling dry run mode"
40 function abandon_review {
44 # echo ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\"
45 if [ $DRY_RUN -eq 1 ]; then
46 echo "Would abandon $gitid"
48 echo "Abandoning $gitid"
49 ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\"
53 PROJECTS="(project:openstack/neutron OR project:openstack/neutron-fwaas OR \
54 project:openstack/neutron-lbaas OR project:openstack/neutron-vpnaas OR \
55 project:openstack/python-neutronclient OR project:openstack/neutron-specs)"
57 blocked_reviews=$(ssh review.openstack.org "gerrit query --current-patch-set --format json $PROJECTS status:open age:4w label:Code-Review<=-2" | jq .currentPatchSet.revision | grep -v null | sed 's/"//g')
59 blocked_msg=$(cat <<EOF
61 This review is > 4 weeks without comment and currently blocked by a
62 core reviewer with a -2. We are abandoning this for now.
64 Feel free to reactivate the review by pressing the restore button and
65 contacting the reviewer with the -2 on this review to ensure you
66 address their concerns.
71 # For testing, put in a git rev of something you own and uncomment
72 # blocked_reviews="b6c4218ae4d75b86c33fa3d37c27bc23b46b6f0f"
74 for review in $blocked_reviews; do
75 # echo ssh review.openstack.org gerrit review $review --abandon --message \"$msg\"
76 echo "Blocked review $review"
77 abandon_review $review $blocked_msg
80 # then purge all the reviews that are > 4w with no changes and Jenkins has -1ed
82 failing_reviews=$(ssh review.openstack.org "gerrit query --current-patch-set --format json $PROJECTS status:open age:4w NOT label:Verified>=1,jenkins" | jq .currentPatchSet.revision | grep -v null | sed 's/"//g')
84 failing_msg=$(cat <<EOF
86 This review is > 4 weeks without comment, and failed Jenkins the last
87 time it was checked. We are abandoning this for now.
89 Feel free to reactivate the review by pressing the restore button and
90 leaving a 'recheck' comment to get fresh test results.
95 for review in $failing_reviews; do
96 echo "Failing review $review"
97 abandon_review $review $failing_msg