A Mozilla release management tool to send reminders to Firefox developers and improve Bugzilla metadata
Перейти к файлу
Suhaib Mujahid 65bf2700b0
[has_str_no_range] Limit the rule to detect bugs (#2171)
2023-07-14 15:34:12 +02:00
.github ci(Mergify): Clean up the merge commit message (#2038) 2023-05-03 18:06:54 -04:00
bugbot [has_str_no_range] Limit the rule to detect bugs (#2171) 2023-07-14 15:34:12 +02:00
configs Turn off BugBug for the Web Compatibility product (#2104) 2023-06-09 13:41:08 -04:00
db Add a db to store the different actions the bot made (#542) 2019-04-16 11:08:33 +02:00
extra Prettify json files 2022-03-16 11:52:07 +01:00
scripts Revert "[patch_closed_bug] Re-enable the rule" 2023-07-12 12:00:04 -04:00
templates Highlight crash address commonalities (#2133) 2023-06-28 11:49:50 -04:00
tests Create a standalone logic to determine version status flags (#2156) 2023-07-10 10:42:39 +02:00
.coveragerc Better automation of the tests in travis + add code coverage 2015-10-22 10:01:52 +02:00
.flake8 Exclude some directories from flake8 checks, and disable line length rule (#720) 2019-06-11 18:30:15 +02:00
.gitignore Replace the word "tool" with "rule" 2023-04-29 18:09:27 -04:00
.isort.cfg Remove seed-isort-config as it's no longer needed since isort 5 (#1785) 2022-11-24 09:58:55 +01:00
.pre-commit-config.yaml Set the default Python version in pre-commit to 3.10 (#2113) 2023-06-22 11:36:19 +00:00
.taskcluster.yml Autoformat .taskcluster.yml 2023-05-14 14:30:53 -04:00
CODE_OF_CONDUCT.md Prettify markdown files 2022-03-16 11:50:48 +01:00
LICENSE Update of the license file (#700) 2019-06-03 10:23:52 +02:00
README.rst Point to the new repository name 2023-04-30 10:19:49 -04:00
alembic.ini Rename `auto_nag` to `bugbot` 2023-04-29 18:09:27 -04:00
pyproject.toml Add djLint and fix violations 2023-04-29 17:24:06 -04:00
requirements-dev.txt Bump coverage from 7.2.6 to 7.2.7 (#2095) 2023-06-06 23:28:16 +02:00
requirements-test.txt Bump tox from 4.6.3 to 4.6.4 (#2158) 2023-07-11 08:58:31 -04:00
requirements.txt Bump numpy from 1.25.0 to 1.25.1 (#2160) 2023-07-11 08:58:23 -04:00
tox.ini Rename `auto_nag` to `bugbot` 2023-04-29 18:09:27 -04:00

README.rst

.. image:: https://community-tc.services.mozilla.com/api/github/v1/repository/mozilla/bugbot/master/badge.svg
    :target: https://community-tc.services.mozilla.com/api/github/v1/repository/mozilla/bugbot/master/latest
.. image:: https://coveralls.io/repos/github/mozilla/bugbot/badge.svg
    :target: https://coveralls.io/github/mozilla/bugbot


This tool is used by Mozilla release management to send emails to the Firefox developers. It will query the bugzilla.mozilla.org database and send emails to Mozilla developers and their managers (if Mozilla staff).

The tool will also notify release managers about potential issues in bugzilla and autofix some categories of issues.

The list of checkers is documented on the Mozilla wiki:
https://wiki.mozilla.org/BugBot


This package currently uses Mozilla's `Bugzilla REST API <https://wiki.mozilla.org/Bugzilla:REST_API>`_, and the Mozilla IAM `phonebook <https://github.com/mozilla-iam/cis/blob/master/docs/PersonAPI.md>`_ (to access bug assignees' managers & Mozilla email addresses).


Installation
------------

#. Check out the code::

    git clone https://github.com/mozilla/bugbot.git

#. (optional) Create your virtualenv using virtualenvwrapper::

    virtualenv -p python3 venv
    source venv/bin/activate

#. Install the dependencies for Python 3 too::

    pip install -r requirements.txt


Running the Bot Rules
---------------------

Before running:

1. The LDAP + SMTP infos are used to send emails
2. Need to generate an API key from bugzilla admin ( https://bugzilla.mozilla.org/userprefs.cgi?tab=apikey )
3. Should generate an API key from Phabricator ( https://phabricator.services.mozilla.com/settings/user )
4. The IAM secrets are used to generate a dump of phonebook, which is required for some scripts (employees can request them by `filing a bug in the SSO: Requests component <https://bugzilla.mozilla.org/enter_bug.cgi?product=Infrastructure%20%26%20Operations&component=SSO%3A%20Requests>`_ )

.. code-block:: json

    # in configs/config.json
    {
      "ldap_username": "xxx@xxxx.xxx",
      "ldap_password": "xxxxxxxxxxxxxx",
      "smtp_server": "smtp.xxx.xxx",
      "smtp_port": 314,
      "smtp_ssl": true,
      "bz_api_key": "xxxxxxxxxxxxxx",
      "bz_api_key_nomail": "xxxxxxxxxxxxxx",
      "phab_api_key": "xxxxxxxxxxxxxx",
      "iam_client_secret": "xxxxxxxxxxxxxx",
      "iam_client_id": "xxxxxxxxxxxxxx"
    }

Do a dryrun::
    python -m bugbot.rules.stalled

There is a ton of rules in bugbot/rules/ so you should be able to find some good examples.

Setting up 'Round Robin' triage rotations
-----------------------------------------

One use case for this tool is managing triage of multiple components across a team of multiple people.

To set up a new Round Robin rotation, a manager or team lead should create a calendar with the rotation of triagers and add a link to the rotation calendar in the `triage rotations spreadsheet <https://docs.google.com/spreadsheets/d/1EK6iCtdD8KP4UflIHscuZo6W5er2vy_TX7vsmaaBVd4>`_.


Running on a server
-------------------

This needs to run on a private server because it will have login for smtp and bugzilla key so it can't currently be shared access.

Cronjob::

    CRON_DIR=/path/to/repository
    00 12  * * 1-5 cd $CRON_DIR ; ./cron_run_weekdays.sh &> /tmp/bugbot-weekdays.log
    00 8   * * *   cd $CRON_DIR ; ./cron_run_daily.sh    &> /tmp/bugbot-daily.log
    40 */1 * * *   cd $CRON_DIR ; ./cron_run_hourly.sh   &> /tmp/bugbot-hourly.log


We run hourly jobs at minute 40 past every hour to avoid overlap with daily jobs.