qa/bugzillaAutomation.py | 66 ++++++++++++++++++++++++++++++++++++++++++----- qa/bugzillaChecker.py | 11 ------- 2 files changed, 61 insertions(+), 16 deletions(-)
New commits: commit fb079edcc027c9e4bf5966484e2a1db003177b0a Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 9 17:55:25 2019 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu May 9 17:55:25 2019 +0200 QA: this can go now diff --git a/qa/bugzillaChecker.py b/qa/bugzillaChecker.py index 8845958..c1b546f 100755 --- a/qa/bugzillaChecker.py +++ b/qa/bugzillaChecker.py @@ -287,21 +287,12 @@ def analyze_bugzilla_checkers(statList, bugzillaData, cfg): commentMail = None comments = row['comments'][1:] - bSameAuthor = True for idx, comment in enumerate(comments): commentMail = comment['creator'] commentDate = datetime.datetime.strptime(comment['time'], "%Y-%m-%dT%H:%M:%SZ") common.util_check_bugzilla_mail(statList, commentMail, '', commentDate, rowId) - if bSameAuthor and commentMail != creatorMail: - bSameAuthor = False - - if bSameAuthor and rowStatus == 'UNCONFIRMED' and \ - datetime.datetime.strptime(row['last_change_time'], "%Y-%m-%dT%H:%M:%SZ") < cfg['retestUnconfirmedPeriod']: - value = [ rowId, row['last_change_time'], creatorMail ] - util_add_to_result(lResults, 'unconfirmed_without_comments', value) - if len(comments) > 0: if rowStatus == 'UNCONFIRMED': if comments[-1]['creator'] != creatorMail and \ @@ -409,7 +400,7 @@ def analyze_bugzilla_checkers(statList, bugzillaData, cfg): if dKey == 'inactive_assignee': if dValue[idx][1] >= cfg['coloredInactiveAssignedPeriod']: background = Back.GREEN - elif dKey == 'unconfirmed_last_comment_not_from_reporter' or dKey == 'unconfirmed_without_comments': + elif dKey == 'unconfirmed_last_comment_not_from_reporter': if dValue[idx][1] >= cfg['coloredRetestUnconfirmedPeriod']: background = Back.GREEN elif dKey == 'unconfirmed_last_comment_from_reporter': commit 145c05bd7bc9ed8e765061456fdfa0c579bbe618 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 9 17:46:35 2019 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu May 9 17:46:35 2019 +0200 QA: Tag unconfirmed bugs inactive for 2 weeks... ...that need a comment diff --git a/qa/bugzillaAutomation.py b/qa/bugzillaAutomation.py index dc6ba3b..7603f44 100755 --- a/qa/bugzillaAutomation.py +++ b/qa/bugzillaAutomation.py @@ -20,6 +20,8 @@ needInfoPingPeriodDays = 180 needInfoFollowUpPingPeriodDays = 30 +needsCommentPeriodDays = 14 + #Path to addObsolete.txt addObsoleteDir = '/home/xisco/dev-tools/qa' @@ -33,7 +35,12 @@ def util_create_statList(): 'untouched': {}, 'needInfoPing': {}, 'needInfoFollowUpPing': {}, - 'needInfoToUnconfirmed': {} + 'needInfoToUnconfirmed': {}, + 'needsComment': + { + 'add': [], + 'remove': [] + } } def analyze_bugzilla(statList, bugzillaData, cfg): print("Analyze bugzilla\n", end="", flush=True) @@ -60,6 +67,7 @@ def analyze_bugzilla(statList, bugzillaData, cfg): statList['needInfoPing'][rowId] = rowCreator comments = row['comments'][1:] + bSameAuthor = True for idx, comment in enumerate(comments): #Check for duplicated comments if idx > 0 and comment['text'] == comments[idx-1]['text']: @@ -73,6 +81,17 @@ def analyze_bugzilla(statList, bugzillaData, cfg): 'MassPing-NeedInfo' in comment["text"]): statList['tags']['addObsolete'].add(comment["id"]) + if bSameAuthor and comment['creator'] != row['creator']: + bSameAuthor = False + + if bSameAuthor and rowStatus == 'UNCONFIRMED' and 'QA:needsComment' not in row['whiteboard'] and \ + datetime.datetime.strptime(row['last_change_time'], "%Y-%m-%dT%H:%M:%SZ") < cfg['needsCommentPeriod']: + statList['needsComment']['add'].append(rowId) + + elif not bSameAuthor and 'QA:needsComment' in row['whiteboard']: + statList['needsComment']['remove'].append(rowId) + + if len(comments) > 0: if rowStatus == 'NEEDINFO' and \ comments[-1]['creator'] == row['creator']: @@ -108,7 +127,7 @@ def analyze_bugzilla(statList, bugzillaData, cfg): row['product'] == 'Impress Remote') and row['severity'] != 'enhancement': statList['untouched'][rowId] = rowCreator -def post_comments_to_bugzilla(statList, keyInStatList, commentId, comment, addFirstLine, changeCommand=""): +def post_comment(statList, keyInStatList, commentId, comment, addFirstLine, changeCommand=""): for bugId, creator in statList[keyInStatList].items(): bugId = str(bugId) @@ -134,27 +153,60 @@ def post_comments_to_bugzilla(statList, keyInStatList, commentId, comment, addFi print('Bug: ' + bugId + ' - ' + changeCommand) rPut.close() +def update_whiteboard(statList, whiteboardTag): + for action, listOfBugs in statList[whiteboardTag].items(): + for bugId in listOfBugs: + bugId = str(bugId) + + urlGet = 'https://bugs.documentfoundation.org/rest/bug/' + bugId + '?api_key=' + cfg['configQA']['api-key'] + rGet = requests.get(urlGet) + rawData = json.loads(rGet.text) + rGet.close() + whiteboard = rawData['bugs'][0]['whiteboard'] + + doRequest = False + tag = 'QA:' + whiteboardTag + if action == 'add': + if rawData['bugs'][0]['status'] == 'UNCONFIRMED' and tag not in whiteboard : + doRequest = True + whiteboard = whiteboard + ' ' + tag + elif action == 'remove': + if tag in whiteboard : + doRequest = True + whiteboard = whiteboard.replace(tag, '').strip() + + if doRequest : + command = '{"whiteboard" : "' + whiteboard.strip() + '"}' + urlPut = 'https://bugs.documentfoundation.org/rest/bug/' + bugId + '?api_key=' + cfg['configQA']['api-key'] + rPut = requests.put(urlPut, command.encode('utf-8')) + print('Bug: ' + bugId + ' - ' + command) + rPut.close() + +def automated_needsCommentFromQA(statList): + print('== Add tag to UNCONFIRMED bug that needs a comment ==') + update_whiteboard(statList, "needsComment") + def automated_needInfoToUnconfirmed(statList): print('== Move NEEDINFO to UNCONFIRMED ==') command = '{"status" : "UNCONFIRMED"}' - post_comments_to_bugzilla(statList, "needInfoToUnconfirmed", 'NeedInfo-To-Unconfirmed', comments.needInfoToUnconfirmedComment, False, command) + post_comment(statList, "needInfoToUnconfirmed", 'NeedInfo-To-Unconfirmed', comments.needInfoToUnconfirmedComment, False, command) def automated_needInfoFollowUpPing(statList): print('== NEEDINFO FollowUp Ping ==') command = '{"status" : "RESOLVED", "resolution" : "INSUFFICIENTDATA"}' - post_comments_to_bugzilla(statList, "needInfoFollowUpPing", 'MassPing-NeedInfo-FollowUp', comments.needInfoFollowUpPingComment, True, command) + post_comment(statList, "needInfoFollowUpPing", 'MassPing-NeedInfo-FollowUp', comments.needInfoFollowUpPingComment, True, command) def automated_needInfoPing(statList): print('== NEEDINFO Ping ==') - post_comments_to_bugzilla(statList, "needInfoPing", 'MassPing-NeedInfo-Ping', comments.needInfoPingComment, True) + post_comment(statList, "needInfoPing", 'MassPing-NeedInfo-Ping', comments.needInfoPingComment, True) def automated_untouched(statList): print('== Untouched bugs ==') - post_comments_to_bugzilla(statList, "untouched", 'MassPing-UntouchedBug', comments.untouchedPingComment, True) + post_comment(statList, "untouched", 'MassPing-UntouchedBug', comments.untouchedPingComment, True) def automated_tagging(statList): #tags are sometimes not saved in bugzilla_dump.json @@ -198,6 +250,7 @@ def runCfg(): cfg['untouchedPeriod'] = common.util_convert_days_to_datetime(untouchedPeriodDays) cfg['needInfoPingPeriod'] = common.util_convert_days_to_datetime(needInfoPingPeriodDays) cfg['needInfoFollowUpPingPeriod'] = common.util_convert_days_to_datetime(needInfoFollowUpPingPeriodDays) + cfg['needsCommentPeriod'] = common.util_convert_days_to_datetime(needsCommentPeriodDays) return cfg @@ -217,3 +270,4 @@ if __name__ == '__main__': automated_needInfoPing(statList) automated_needInfoFollowUpPing(statList) automated_needInfoToUnconfirmed(statList) + automated_needsCommentFromQA(statList) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits