A Mozilla release management tool to send reminders to Firefox developers and improve Bugzilla metadata
Перейти к файлу
pyup.io bot 22a6882638 Update alembic from 1.0.9 to 1.0.10 (#614) 2019-04-29 10:03:42 +02:00
auto_nag regression_without_regressed_by: consider unaccessible bugs as invalid (#612) 2019-04-26 16:14:28 +02:00
db Add a db to store the different actions the bot made (#542) 2019-04-16 11:08:33 +02:00
templates regression_without_regressed_by: consider unaccessible bugs as invalid (#612) 2019-04-26 16:14:28 +02:00
.coveragerc Better automation of the tests in travis + add code coverage 2015-10-22 10:01:52 +02:00
.flake8 fix the regexp declarations 2018-10-29 11:30:02 +01:00
.gitignore Add a db to store the different actions the bot made (#542) 2019-04-16 11:08:33 +02:00
.travis.yml Stop executing removed script (#515) 2019-04-03 18:19:59 +02:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file (#484) 2019-03-28 09:44:00 +01:00
LICENSE a very slow bzattach using the rest api 2009-11-19 22:42:16 -08:00
MANIFEST.in a very slow bzattach using the rest api 2009-11-19 22:42:16 -08:00
README.rst add a link to the wiki (#511) 2019-04-05 13:32:38 +02:00
alembic.ini Add a db to store the different actions the bot made (#542) 2019-04-16 11:08:33 +02:00
requirements-dev.txt Initial Update (#505) 2019-04-08 12:24:03 +02:00
requirements-test.txt Initial Update (#505) 2019-04-08 12:24:03 +02:00
requirements.txt Update alembic from 1.0.9 to 1.0.10 (#614) 2019-04-29 10:03:42 +02:00
runauto_nag_common.sh Fix PYTHONPATH (#502) 2019-04-01 12:09:12 +02:00
runauto_nag_daily.sh Fix PYTHONPATH (#502) 2019-04-01 12:09:12 +02:00
runauto_nag_daily_py2.sh Add a new tool: regression_without_regressed_by (#605) 2019-04-26 15:40:22 +02:00
runauto_nag_daily_py3.sh defectenhancementtask: Enable it (#586) 2019-04-18 18:16:01 +02:00
runauto_nag_hourly.sh Fix PYTHONPATH (#502) 2019-04-01 12:09:12 +02:00
runauto_nag_hourly_py2.sh regression_but_type_enhancement_task: Now that it has an autofix, move it to every hour (#565) 2019-04-16 14:33:18 +02:00
runauto_nag_hourly_py3.sh Separate python2 from python3 (#501) 2019-04-01 10:39:38 +02:00
setup.py Issue #150: Use HTTPS links in emails and initial set up of the app (#151) 2018-05-23 02:50:10 +02:00
tox.ini Add a db to store the different actions the bot made (#542) 2019-04-16 11:08:33 +02:00

README.rst

.. image:: https://travis-ci.org/mozilla/relman-auto-nag.svg?branch=master
    :target: https://travis-ci.org/mozilla/relman-auto-nag
.. image:: https://coveralls.io/repos/github/mozilla/relman-auto-nag/badge.svg
    :target: https://coveralls.io/github/mozilla/relman-auto-nag

    
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/Release_Management/autonag


This package currently uses `remoteobjects <https://github.com/saymedia/remoteobjects>`_ models, Mozilla's `Bugzilla REST API <https://wiki.mozilla.org/Bugzilla:REST_API>`_, and optionally the Mozilla LDAP `phonebook <https://github.com/mozilla/mobile-phonebook>`_ (to access bug assignees' managers & Mozilla email addresses).


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

Currently, this package depends on a pre-release version of remoteobjects, so
we'll have to do this the long way.

#. Check out the code::

    git clone git://github.com/mozilla/relman-auto-nag.git

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

    virtualenv --no-site-packages venv

#. Install pip::

    easy_install pip

#. Install the dependencies for bztools::

    pip install -r requirements.txt

#. Install the dependencies for Python 3 too::

    pip3 install -r requirements.txt

#. Run setup.py so the scripts are installed to your bin directory::

    python setup.py install

Note to developers: if you make any changes to the bugzilla/ files (agents, models, utils) during
work on other scripts, you will want to re-install the scripts as instructed above in order to pick
up changes

To run it into production, you will need the full list of employees + managers.

Usage
----------

Example::

    from auto_nag.bugzilla.agents import BMOAgent

    # We can use "None" for both instead to not authenticate
    api_key = 'xxx'

    # Load our agent for BMO
    bmo = BMOAgent(api_key)

    # Set whatever REST API options we want
    options = {
        'changed_after':    ['2010-12-24'],
        'changed_before':   ['2010-12-26'],
        'changed_field':    ['status'],
        'changed_field_to': ['RESOLVED'],
        'product':          ['Core,Firefox'],
        'resolution':       ['FIXED'],
        'include_fields':   ['_default,attachments'],
    }

    # Get the bugs from the api
    buglist = bmo.get_bug_list(options)

    print "Found %s bugs" % (len(buglist))

    for bug in buglist:
        print bug

Query Creator, Automated Nagging Script
---------------------------------------

Before running::

1. You'll need to create a writeable 'queries' directory at the top level of the checkout where the script is run from.
2. Need a local config for phonebook auth with your LDAP info
3. Need to generate an API key from bugzilla admin ( https://bugzilla.mozilla.org/userprefs.cgi?tab=apikey )

.. code-block:: bash

    # in scripts/configs/config.json
    {
      "ldap_username": "you@mozilla.com",
      "ldap_password": "xxxxxxxxxxxxxx",
      "bz_api_key": "xxxxxxxxxxxxxx"
    }

Do a dryrun::
    python auto_nag/scripts/query_creator.py -d

The script does the following:
* you will need a local config for smtp auth with your LDAP info::
    # in scripts/configs/config.json
    {
        "ldap_username": "you@mozilla.com",
        "ldap_password": "xxxxxxxxxxxxxx",
        "bz_api_key": "xxxxxxxxxxxxxx"
    }
* Creates queries based on the day of the week the script is run
* Polls the bugzilla API with each query supplied and builds a dictionary of bugs found per query
* For each bug, finds the assignee and if possible the assignee's manager - then adds the bug to the manager's bug bucket for later email notification
* Goes through the manager dictionary and constructs an email with the bugs assigned to that manager's team members
* Outputs the message to console and waits for use input to either send/edit/cancel (save for manual notification)
* At the end it provides a list of all bugs that were not emailed about and provides the url for bugzilla of that buglist


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::

  00 14 * * 1-5 $HOME/run_autonags_daily.sh &> /tmp/autonag.log
  15 */1 * * * $HOME/runauto_nag_hourly.sh &> /tmp/autonag-hour.log


Running the testsuite
---------------------

.. code-block:: bash

    tox -e py27