Help:Bugzilla Extension

This is a very useful extension to Mediawiki that queries Bugzilla and can display information as a table or a bar/pie chart.

As a reference, here are the bz_api fields you may be able to use with the mediawiki-bugzilla extension: https://wiki.mozilla.org/Help:Bugzilla_Extension

Please add code samples and any additional tips on usage here!

Note: be cautious using the "Preview" mode of the wiki page editor. In the preview context, all matches are returned in a simple table. The fancy chunked display is only available using the "Show Preview" button outside of the editor.

How to Use

You use this extension in this way:

<bugzilla>
    (JSON REST API query key/value pairs)
</bugzilla>

An example:

<bugzilla>
    {
        "product": "Bugzilla",
        "priority":"P1"
    }
</bugzilla>

Example that gathers all the bugs that block a particular bug:

<bugzilla>
{
 "f1":"blocked",
 "o1":"equals",
 "v1":"738796",
 "include_fields":"id,summary,status,resolution"
}
</bugzilla>

For more details on how to query in various ways, see the documentation for the Bugzilla BzAPI REST API.

Note that the tag name defaults to "bugzilla" but is configurable.

There is also exploratory support for charting. Here are some examples:

<bugzilla type="count" display="bar">
    {
        "product":      "Bugzilla",
        "priority":     "P1",
        "x_axis_field": "severity"
    }
</bugzilla>

This example uses date ranges and returns bugs from multiple products:

<bugzilla type="count" display="bar">
    {
        "product":      ["Core","Calendar","Toolkit","Firefox"],
        "changed_after": "2000-01-01",
        "changed_before": "2013-02-01",
         "whiteboard":     "[good first bug]",
        "status":["NEW","REOPENED"],
        "x_axis_field": "product"
    }
</bugzilla>

This example uses date ranges to retrieve the bugs from multiple products with a specific resolution and where the status is the field changed during the date range selected:

<bugzilla type="count" display="bar">
    {
        "product":  ["Core","Calendar","Toolkit","Firefox",  "Thunderbird"],
        "whiteboard":     "[good first bug]", 
        "changed_after": "2013-07-01",
        "changed_before": "2013-08-01",
        "changed_field": "status",
        "changed_field_to": ["RESOLVED"],
         "resolution": ["FIXED", "INVALID", "WONTFIX", "DUPLICATE", "WORKSFORME", "INCOMPLETE"],  
        "x_axis_field": "product"
    }
</bugzilla>

Complex queries

If you have a bugzilla query with f1, o1, and v1 parameters you can make a mediawiki-bugzilla chart with those parameters. So if you have field 1, with operator 1 and value 1, they go together; so you can put f2, o2, v2 and so on into your wiki chart. You can further connect two such queries by starting out your query with f1=OP and j1=OR to have a higher level operator such as AND and OR.

To figure out a complex query, try building the query in bugzilla first, then copy the url and paste it somewhere that you can split it up, parse it, and pull out the elements you need like nosubstr or anywordssubstr. The url should have all the clues you need to construct your mediawiki query.

Example:
<bugzilla>
{
"include_fields":"id,summary,status,qa_contact,whiteboard,cf_qa_whiteboard",
 "f1":"OP",
 "j1":"OR",
 "f2":"cf_fx_iteration",
 "o2":"equals",
 "v2":"34.1",
 "f3":"status_whiteboard",
 "o3":"anywordssubstr",
 "v3":"s=34.1"
}
</bugzilla>

Bugzilla query error

Array ( [type] => error [message] => http-bad-status [params] => Array ( [0] => 406 [1] => Not Acceptable ) ) 1


Code repo

The mediawiki-bugzilla extension code is here: https://github.com/mozilla/mediawiki-bugzilla


Troubleshooting

  • If you get a query error, try checking the last parameter in your list; make sure that line doesn't end with a comma.