~canonical-platform-qa/qlbr/trunk

« back to all changes in this revision

Viewing changes to README

Merged documentation and static analysis changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
QA Launchpad Bug Reports (qlbr)
2
2
 
3
3
ABOUT:
4
 
The scripts here are intended to generate bug reports for the QA team.  They are similar in principle to collect-bug-data and reporter from lp:arsenal, but implemented using a django datastore rather than json files.
 
4
The django application here is intended to generate bug reports for the QA 
 
5
team.  Some functions are similar in principle to collect-bug-data and 
 
6
reporter from lp:arsenal, but implemented using a django datastore rather 
 
7
than json files.
5
8
 
6
9
SETUP:
7
 
To run the scripts, the DJANGO_SETTINGS_MODULE environment must be set to "qlbr.settings", i.e.:
8
 
export DJANGO_SETTINGS_MODULE=qlbr.settings
9
 
 
10
 
The current version depends on the development version of django as of 2013/11/5, primarily for the update_or_create method of the QuerySet object.  If you have pip and git (sudo apt-get install python-pip git) you can run these commands:
11
 
git clone git://github.com/django/django.git django-trunk
12
 
sudo pip install -e django-trunk/
13
 
You may wish to use a container or virtualenv if you do not wish to install the development version of django in your main development environment.
14
 
 
15
 
If you with to use something other than /home/ubuntu/bzr/qlbr/qlbr.sqlite as the database, edit qlbr/settings.py.  Once you have your database selected, run
16
 
python manage.py syncdb
17
 
to establish the database, per usual django usage.
18
 
 
19
 
You will need the python launchpad libraries (sudo apt-get install python-launchpadlib) to gather task data or update people.
20
 
 
21
 
 
22
 
USAGE:
23
 
#TODO: update this with django information
24
 
load-searches.py accepts a list of files as command line arguments to populate the datastore with information on bug searches to be performed against launchpad.  searches.json is provided as an example.  Each search must have a name.  A list of tags to be applied to retrieved tasks for filtering later is optional.  At least one project is required to perform any searches, and criteria are required to avoid returning all bugs from that project.
25
 
 
26
 
get-task-data.py performs launchpad searches as defined in the Search model, which may be populated by load-searhes.py.  With no Search data, no tasks will be retrieved.  By default, all searched as performed with 'modified_since' equal to the last_update property of the Search object, which is updated when get-task-data.py completes a search.  To search without this option, pass 'reload' as a command line argument to the script.  The script will gather information about each task returned by each search, each bug associated with those tasks, each bug that one of those bugs is a duplicate of, at least one task for each duplicated bug, and each person listed as owner or assignee of a task or bug.  Tasks and bugs are retrieved only once per run of the script, and people are not retrieved if they are already present in the local datastore.
27
 
 
28
 
update-people.py retrieves updated information on all Person objects in the local datastore.  Since this information changes rarely and is relatively expensive to retrieve, this can be run less often than get-task-data.
29
 
 
30
 
generate-static-report.py IS STILL VERY MUCH A PROTOTYPE.  The other scripts exists in basically a usable form that may be similar to their final form, but this script currently only generates a single report, pending discussion on how report parameters should be specified.  It will gather all bugs in the local datastore and create a test.html document titled 'Test' that includes a header allowing for date range selection.  Bugs with "closed" statuses will be available, but hidden by default.  The template, title, filename, and some sort of filter for the bugs included should be specifiable as parameters, but currently aren't.  THIS WILL CHANGE SOON.
31
 
 
32
 
qa-default.mako is a mako template for bug reports.  It is based on one provided to me by Brad Figg of the Canonical kernel team.  It is modified to suit the needs of the QA team.  It expects the following parameters:
33
 
    report_title (str)
34
 
    timestamp (str)
35
 
    datefilter (bool) (whether to show the date filter at the top of the page)
36
 
    tasks (dict) (TODO: document this better once the format is nailed down)
37
 
 
38
 
manage.py is created by django
39
 
 
40
 
qlbr is the django project thingy.  I have made the following modifications:
41
 
 
42
 
qlbr/settings.py:
43
 
    set ENGINE and NAME for 'default' entry in DATABASES
44
 
 
45
 
qlbr/__init__.py:
46
 
    setup basic logging
47
 
    provide LP object for launchpad access
48
 
    provide TZ object, instance of tzinfo subclass that provided minimum functionality to make a datetime.datetime object aware and located in UTC
49
 
 
50
 
qlbr/models.py:
 
10
The official deployment is being finalized.
 
11
For testing/hacking/running your own, do this:
 
12
    sudo apt-get -y --force-yes install bzr python-django python-django-nose
 
13
    bzr branch lp:~nuclearbob/qlbr/untriaged qlbr
 
14
    cd qlbr
 
15
    cp qlbr/local_settings_example.py to qlbr/local_settings.py
 
16
    python manage.py syncdb --noinput
 
17
    python manage.py load_searches qlbr/searches.json
 
18
    python manage.py get_task_data reload
 
19
    python manage.py runserver 0.0.0.0:8000
 
20
Installation in a container or instance is recommended.
 
21
 
 
22
The current version recommends django 1.5, packaged in saucy and later 
 
23
releases.  1.4 (packaged in precise through raring) may work, but is not 
 
24
guaranteed to in the future.
 
25
 
 
26
If you with to use something other than /home/ubuntu/bzr/qlbr/qlbr.sqlite as 
 
27
the database, edit qlbr/settings.py before running syncdb.  --noinput is 
 
28
intended for automated deployment, and not stricly needed.
 
29
 
 
30
You will need the python launchpad libraries 
 
31
(sudo apt-get install python-launchpadlib) 
 
32
to gather task data or update people.
 
33
 
 
34
 
 
35
COMMANDS:
 
36
Most commands are run via:
 
37
    python manage.py command_name arguments
 
38
 
 
39
load_searches accepts a list of files as command line arguments to populate 
 
40
the datastore with information on bug searches to be performed against 
 
41
launchpad.  searches.json is provided as an example.  Each search must have a 
 
42
name.  A list of tags to be applied to retrieved tasks for filtering later is 
 
43
optional.  At least one project is required to perform any searches, and 
 
44
criteria are required to avoid returning all bugs from that project.
 
45
 
 
46
get_task_data performs launchpad searches as defined in the Search model, 
 
47
which may be populated by load_searhes.  With no Search data, no tasks will 
 
48
be retrieved.  By default, all searches are performed with 'modified_since' 
 
49
equal to the last_update property of the Search object, which is updated when 
 
50
get_task_data completes a search.  To search without this option, pass 
 
51
'reload' as a command line argument.  The script will gather information 
 
52
about each task returned by each search, each bug associated with those 
 
53
tasks, each bug that one of those bugs is a duplicate of, at least one task 
 
54
for each duplicated bug, and each person listed as owner or assignee of a 
 
55
task or bug.  Tasks and bugs are retrieved only once per run of the script, 
 
56
and people are not retrieved if they are already present in the local 
 
57
datastore.  Run this as often as you want to update task data.  Running more 
 
58
often than every 15 minutes may produce undesirable results, especially on a 
 
59
slow machine.
 
60
 
 
61
update_people retrieves updated information on all Person objects in the 
 
62
local datastore.  Since this information changes rarely and is relatively 
 
63
expensive to retrieve, this can be run less often than get_task_data.  Daily 
 
64
or even weekly is not unreasonable.
 
65
 
 
66
 
 
67
MODELS:
51
68
    (All models should have a reasonable __str__ defined)
52
69
    SearchTag: used by Search and Task
53
70
    Item: used by Criterion
54
 
    Criterion: used by search.  Can be a key/value pair, or a key/[list of values].  get returns the appropriate value or [list]
 
71
    Criterion: used by search.  Can be a key/value pair, or a 
 
72
               key/[list of values].
 
73
               get returns the appropriate value or [list]
55
74
    Project: used by Search
56
75
    Search: describes a search.  Contains:
57
76
        name (str)
58
77
        search_tags (list of SearchTag)
59
78
        projects (list of Project)
60
79
        criteria (list of Criterion)
61
 
        last_update (timestamp, automatically updated, updated when search completes)
62
 
        Also provide criteria_dict to pass as an argument to the launchpad search
 
80
        last_update (timestamp, automatically updated,
 
81
                     updated when search completes)
 
82
        Also provides criteria_dict to pass as an argument
 
83
        to the launchpad search
63
84
    Person: describes a person.  Contains:
64
85
        self_link (str/url, primary key)
65
86
        web_link (str/url)
78
99
        duplicate_of (Bug or None)
79
100
        title (str)
80
101
        last_update (timestamp, automatically updated)
81
 
        Also provides tag_list as a string, triaged as a bool (seealso: TRIAGED)
 
102
        Also provides tag_list as a string, triaged as a bool
 
103
        (seealso: TRIAGED)
82
104
    Task: describes a bug task.  Contains:
83
105
        self_link (str/url, primary key)
84
106
        web_link (str/url)
95
117
        Also provides triaged as a bool (seealso: TRIAGED)
96
118
 
97
119
TRIAGED: (SUBJECT TO CHANGE)
98
 
If a bug has a tag matching rls-[a-z]-incoming, it is considered triaged.  If a bug has any task marked as "Fix Released" it is considered triaged.  If it is a duplicate, it inherits triaged status from the original bug, regardless of these criteria.  A task is considered triaged if its bug is triaged.  If the bug is not triaged, and the task has status "New" then the task is not triaged, and will appear in reports as such.
99
 
 
100
 
All files except manage.py, qa-default.mako, and files under the QLBR directory are copyright 2013 Canonical.
101
 
TODO: add proper copyright notices and license info (Affero GPLv3 since this will be running as a web service?)
 
120
If a bug has a tag matching rls-[a-z]-incoming, it is considered triaged.  If 
 
121
a bug has any task marked as "Fix Released" it is considered triaged.  If it 
 
122
is a duplicate, it inherits triaged status from the original bug, regardless 
 
123
of these criteria.  A task is considered triaged if its bug is triaged.  If 
 
124
the bug is not triaged, and the task has status "New" then the task is not 
 
125
triaged, and will appear in reports as such.
 
126
 
 
127
VIEWS:
 
128
The main "index" view will gather all bugs in the local datastore and return 
 
129
a page titled 'QA Bugs' that includes a header allowing for date range 
 
130
selection, using the qa-defaut.html template.  Bugs with "closed" statuses 
 
131
will be available, but hidden by default.
 
132
The /untriaged view will omit triaged bugs.  THIS WILL LIKELY BE A TOGGLE ON 
 
133
THE PAGE IN THE FUTURE.
 
134
 
 
135
qa-default.html is a template for bug reports.  It is based on one provided 
 
136
to me by Brad Figg of the Canonical kernel team.  It is modified to suit the 
 
137
needs of the QA team.  It expects the following parameters:
 
138
    report_title (str)
 
139
    timestamp (str)
 
140
    datefilter (bool) (whether to show the date filter at the top of the page)
 
141
    tasks (dict) (TODO: document this better once the format is nailed down)
 
142
    target_report_order (list of tuples) (contains bug_target_name and 
 
143
                                          bug_target_display_name pairs)
 
144
    tasks_json_dump (str) (json of tasks object)
 
145
 
 
146
 
 
147
All files not automatically generated by django are copyright 2013 Canonical.