# Script to "retire" a gerrit account given its All-Users ref, eg: # refs/users/34/1234 # This script should be run within the root of an All-Users repo. # # This will remove the preferred email from the account to fix # issues where the preferred email has no corresponding external id # and set the account to inactive. # # The commit message heredoc should be edited appropriately before # running this script. set -ex REF=$1 git fetch origin $REF git checkout FETCH_HEAD sed -i -e '/^\tpreferredEmail = .*/d' account.config # Gerrit accounts are active by default and don't have active record # entries when active. if ! grep 'active = false' account.config ; then echo -e "\tactive = false" >> account.config fi git add account.config git commit -F - << EOF Retire this account Set the account to inactive and remove its preferred email address. This account appears to be an old style third party CI account. One which the Gerrit admins manually added it as a system account. For a while now we've asked third party CI operators to transition to openid based accounts to reduce our workload. These third party CI systems don't appear currently active and retiring them will fix Gerrit consistency errors. If necessary they can create more modern openid based accounts for their CI systems. We are doing this to fix these Gerrit consistency errors: Account 'ABXY' has no external ID for its preferred email 'ABXY@example.com' EOF #echo '## Verify this commit is correct with git show HEAD' #echo "## If things look good run git push origin HEAD:$REF" git show HEAD git push origin HEAD:$REF