gerrit_cq.py: Add check to ensure missing emails are handled

Currently the exonerator is not handling messages without emails, which
does appear to be happening, therefore we need to check for email before
handling the message.

BUG=chromium:985435
TEST='deploy to prod; watch logs'

Change-Id: Ib2fa56d4b981e9dab977acc3ccb586084b1d279e
Reviewed-on: https://chromium-review.googlesource.com/1709236
Tested-by: Mike Nichols <mikenichols@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Nichols <mikenichols@chromium.org>
Reviewed-by: Dhanya Ganesh <dhanyaganesh@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
1 file changed
tree: 66eb976cdc6d04661c09a884fa4c29d4b99ecdf3
  1. bin/
  2. exonerator/
  3. flex_ts_mon/
  4. testing_utils/
  5. .gitignore
  6. app.yaml
  7. config.py
  8. cron.yaml
  9. debug_routes.py
  10. debug_routes_test.py
  11. deploy_app.py
  12. gunicorn.conf.py
  13. main.py
  14. main_test.py
  15. OWNERS
  16. Pipfile
  17. Pipfile.lock
  18. PRESUBMIT.cfg
  19. pytest.ini
  20. README.md
README.md

CL Exonerator

https://chromium.googlesource.com/chromiumos/infra/cl_exonerator

Purpose:

This app finds CLs which were incorrectly blamed for a CQ failure, and re-marks them as CQ-ready. It does this by polling cidb‘s buildMessageTable for finalize messages, then finds CLs which were blamed in the build’s annotatations and marks them as CQ+1 in Gerrit (if they haven't already been).

Credentials

Create a “creds” folder, then:

  • For local development, run “cros cidbcreds --folder=creds/cidb” to fetch the readonly credentials.

  • For deploying to production, see go/cros-cidb-admin and get the prod_cidb_gen2_annotator credentials.

Development

Local deployment is done by creating a virtualenv with pipenv:

# pipsi is a nice python utility for installing other python scripts in their
# own virtualenvs, so you don't get version conflicts between the various
# scripts installed on your system.
sudo `which pip` install pipsi
pipsi install pipenv
pipenv install --dev
pipenv shell

Tests are run with pytest:

pipenv run pytest exonerator

Start a development server with bin/local_server and run curl -u admin http://localhost:8080/cls?type=pending to see a list of pending CLs.

Deployment

CL-Exonerator is deployed to the google.com:chromiumos-cl-exonerator project. Before deploying, make sure you have activated it as your default project with gcloud:

gcloud config set project chromiumos-cl-exonerator

Then deploy with the ./deploy_app script:

pipenv shell
./deploy_app
  • Debug environment:

Run ./deploy_app --debug=True after copying or symlinking debug_cidbi_gen2_bot creds into ./creds/cidb.dbg (see the [Credentials][#Credentials] section)

  • Production:

Run “./deploy_app” after copying or symlinking prod_cidb_gen2_bot creds into “./creds/cidb”.