From 74e36c01f4f0aa28b0af075fdae000571929b5c2 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Fri, 8 Jan 2016 18:06:43 +0100 Subject: [PATCH] Add instructions on how to disable a third party ci account Change-Id: Idb04a31a6b3b4697d2199e601b0a1b4d4bff0c85 --- doc/source/gerrit.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst index df07dee49e..ac0feed04f 100644 --- a/doc/source/gerrit.rst +++ b/doc/source/gerrit.rst @@ -656,3 +656,41 @@ When there is a change in HTML headers, or CSS, this can be applied without the need of restarting Gerrit. To do that, ssh in the Gerrit instance, and touch GerritSiteHeader.html and/or GerritSite.css, under /home/gerrit2/review_site/etc directory. + +Deactivating a Gerrit account +----------------------------- + +To deactivate a Gerrit account (use case can be a failing Third Party CI), you +must follow that steps: + +1. Identify the account ID of the Third Party CI you need to deactivate. Third-Party CI + members can be found on: https://review.openstack.org/#/admin/groups/270,members + + That will give you the name and email of all members. Then you can get the matching + numerical account ID with the help of REST API: + curl -i -H "Accept: application/json" --digest --user <>:<> -X GET https://review.openstack.org/a/accounts/{email} + + This will return a JSON dictionary, that will contain _account_id field. + +2. Mark the account as inactive using gerrit ssh api, with: + ssh -p 29418 review.openstack.org gerrit set-account --inactive {account-id} + + Alternatively you can use REST API, sending a DELETE for: + curl -i -H "Accept: application/json" --digest --user <>:<> -X DELETE https://review.openstack.org/a/accounts/{account-id}/active + +3. Check if there are active gerrit ssh connections: + ssh -p 29418 review.openstack.org gerrit show-connections -n | grep {account-id} + + And kill all of them with subsequent: + ssh -p 29418 review.openstack.org gerrit close-connection {connection-id} + +4. You can check if the account is properly marked as inactive using REST API, + sending a GET for: + + curl -i -H "Accept: application/json" --digest --user <>:<> -X GET https://review.openstack.org/a/accounts/{account-id}/active + + A 200 return code means the account is active, and 204 means account inactive. + +4. In the case of a failing Third Party CI, if the account caused a loop of comments in + a change, you can delete them with following query: + delete from change_messages where author_id={account-id} and change_id={change-id};