-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab7ceac
commit 821db8e
Showing
8 changed files
with
232 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from datetime import datetime | ||
|
||
from libmozdata import utils as lmdutils | ||
|
||
from auto_nag import utils | ||
from auto_nag.bzcleaner import BzCleaner | ||
from auto_nag.component_triagers import ComponentName | ||
from auto_nag.escalation import Escalation | ||
from auto_nag.nag_me import Nag | ||
from auto_nag.round_robin import RoundRobin | ||
|
||
ESCALATION_CONFIG = { | ||
"first": { | ||
"default": { | ||
"[0;+∞[": { | ||
"supervisor": "self", | ||
"days": ["Mon", "Tue", "Wed", "Thu", "Fri"], | ||
}, | ||
}, | ||
}, | ||
"second": { | ||
"default": { | ||
"[0;+∞[": { | ||
"supervisor": "n+1", | ||
"days": ["Mon", "Thu"], | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
|
||
class NotTriaged(BzCleaner, Nag): | ||
"""Not triage bugs""" | ||
|
||
def __init__(self, typ, first_step_weeks: int = 2, second_step_weeks: int = 4): | ||
"""Constructor | ||
Args: | ||
typ | ||
first_step_weeks | ||
second_step_weeks | ||
""" | ||
super().__init__() | ||
self.date: datetime | ||
self.typ = typ | ||
self.lookup_first = first_step_weeks | ||
self.lookup_second = second_step_weeks | ||
self.escalation = Escalation( | ||
self.people, | ||
data=ESCALATION_CONFIG[typ], | ||
skiplist=utils.get_config("workflow", "supervisor_skiplist", []), | ||
) | ||
self.round_robin = RoundRobin.get_instance() | ||
self.components_skiplist = { | ||
ComponentName.from_str(pc) | ||
for pc in utils.get_config("workflow", "components_skiplist") | ||
} | ||
|
||
def description(self): | ||
return "Bugs that are not triaged" | ||
|
||
def nag_template(self): | ||
return self.template() | ||
|
||
def nag_preamble(self): | ||
return True | ||
|
||
def get_extra_for_template(self): | ||
return { | ||
"nweeks": self.lookup_first if self.typ == "first" else self.lookup_second | ||
} | ||
|
||
def get_extra_for_needinfo_template(self): | ||
return self.get_extra_for_template() | ||
|
||
def get_extra_for_nag_template(self): | ||
return self.get_extra_for_template() | ||
|
||
def has_product_component(self): | ||
return True | ||
|
||
def ignore_meta(self): | ||
return True | ||
|
||
def columns(self): | ||
return ["component", "id", "summary"] | ||
|
||
def handle_bug(self, bug, data): | ||
if ComponentName.from_bug(bug) in self.components_skiplist: | ||
return None | ||
return bug | ||
|
||
def get_mail_to_auto_ni(self, bug): | ||
if self.typ == "second": | ||
return None | ||
|
||
mail, nick = self.round_robin.get(bug, self.date) | ||
if mail and nick: | ||
return {"mail": mail, "nickname": nick} | ||
|
||
return None | ||
|
||
def set_people_to_nag(self, bug, buginfo): | ||
priority = "default" | ||
if not self.filter_bug(priority): | ||
return None | ||
|
||
# don't nag in the first step (just a ni is enough) | ||
if self.typ == "first": | ||
return bug | ||
|
||
owners = self.round_robin.get(bug, self.date, only_one=False, has_nick=False) | ||
real_owner = bug["triage_owner"] | ||
self.add_triage_owner(owners, real_owner=real_owner) | ||
if not self.add(owners, buginfo, priority=priority): | ||
self.add_no_manager(buginfo["id"]) | ||
return bug | ||
|
||
def get_bz_params(self, date): | ||
fields = ["triage_owner", "flags"] | ||
params = { | ||
"include_fields": fields, | ||
"keywords": ["intermittent-failure", "triaged"], | ||
"keywords_type": "nowords", | ||
"email2": "wptsync@mozilla.bugs", | ||
"emailreporter2": "1", | ||
"emailtype2": "notequals", | ||
"resolution": "---", | ||
"f21": "bug_type", | ||
"o21": "equals", | ||
"v21": "defect", | ||
"f22": "flagtypes.name", | ||
"o22": "notsubstring", | ||
"v22": "needinfo?", | ||
} | ||
self.date = lmdutils.get_date_ymd(date) | ||
first = f"-{self.lookup_first * 7}d" | ||
second = f"-{self.lookup_second * 7}d" | ||
if self.typ == "first": | ||
params.update( | ||
{ | ||
"j14": "AND", | ||
"f14": "OP", | ||
"f15": "creation_ts", | ||
"o15": "lessthaneq", | ||
"v15": first, | ||
"f16": "creation_ts", | ||
"o16": "greaterthan", | ||
"v16": second, | ||
"f19": "CP", | ||
} | ||
) | ||
else: | ||
params.update( | ||
{ | ||
"f12": "creation_ts", | ||
"o12": "lessthaneq", | ||
"v12": second, | ||
} | ||
) | ||
|
||
return params | ||
|
||
|
||
if __name__ == "__main__": | ||
NotTriaged("first").run() | ||
NotTriaged("second").run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% if nag_preamble %} | ||
<p> | ||
<ul> | ||
<li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/policies/triage-bugzilla.html#why-triage">Why triage?</a></li> | ||
<li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/policies/triage-bugzilla.html#what-do-you-triage">What do you triage?</a></li> | ||
<li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/guides/priority.html">Priority definitions</a></li> | ||
<li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/guides/severity.html">Severty definitions</a></li> | ||
</ul> | ||
</p> | ||
{% endif %} | ||
|
||
<p> | ||
The following {{ plural('bug has', data, pword='bugs have') }} not triaged for the last {{ extra['nweeks'] }} {{ plural('week', extra['nweeks']) }}: | ||
</p> | ||
<table {{ table_attrs }}> | ||
<thead> | ||
<tr> | ||
<th>Component</th><th>Bug</th><th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for i, (comp, bugid, summary) in enumerate(data) -%} | ||
<tr {% if i % 2 == 0 %}bgcolor="#E0E0E0"{% endif -%}> | ||
<td> | ||
{{ comp | e }} | ||
</td> | ||
<td> | ||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{ bugid }}">{{ bugid }}</a> | ||
</td> | ||
<td> | ||
{{ summary | e }} | ||
</td> | ||
</tr> | ||
{% endfor -%} | ||
</tbody> | ||
</table> | ||
{% if query_url_nag %}<p>See the query on <a href="{{ query_url_nag }}">Bugzilla</a>.</p>{% endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:{{ nickname }}, could you please triage this bug? |