-
Notifications
You must be signed in to change notification settings - Fork 18
/
helpers.py
1070 lines (940 loc) · 28.3 KB
/
helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from __future__ import division, print_function
import copy
import smtplib
import ssl
from config import *
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
BASE_QUERY = {
"bug_status": None,
"f3": "OP",
"f6": "CP",
"f8": "flagtypes.name",
"j3": "OR",
"o8": "anywordssubstr",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v8": ""
}
def send_email(gmail_user, gmail_password, recipients, subject, body):
sent_from = gmail_user
msg = MIMEMultipart('alternative')
msg['Subject'] = subject
msg['From'] = gmail_user
msg['To'] = ", ".join(recipients)
# Create the body of the message (a plain-text and an HTML version).
text = body
# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(text, 'html')
# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part1)
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_user, gmail_password)
server.sendmail(sent_from, recipients, msg.as_string())
server.close()
print('Email sent!')
except:
print('Something went wrong...{}', sys.exc_info()[0])
def all_members():
memb_list = teams.values()
return [mem for team in memb_list for mem in team]
def all_bugs(bugs_dict):
bug_list = bugs_dict.values()
return [bug for comp in bug_list for bug in comp]
def get_bug_url_link(bug_ids):
return (
"https://bugzilla.redhat.com/buglist.cgi?bug_id={}".format(
','.join(bug_ids)
)
)
def report_needinfos():
team_bugs = []
needinfos = get_needinfos_bugs()
all_team_members = all_members()
for bug in needinfos:
bug_flags = bug.flags[0]
requestee = bug_flags.get('requestee')
try:
req = requestee.split("@")[0]
if req in all_team_members:
team_bugs.append(bug)
except AttributeError as ex:
print(
"No needinfo contact for bug {}".format(bug.id)
)
for bug in team_bugs:
short_url = get_bug_url_link([str(bug.id)])
link = "<a href='{}' target='_blank'>(Link)".format(short_url)
print(
"<li>{} [{}] [{}]: {} {}</li>".format(
bug.bug_id, bug.status, bug.flags[0].get('requestee').split("@")[0], bug.summary, link
)
)
def report_status_on_qa():
on_qa = get_on_qa_bugs()
total_on_qa = len(on_qa)
bug_id_list = [str(bug.id) for bug in on_qa]
short_url = get_bug_url_link(bug_id_list)
link = ""
if len(bug_id_list):
link = "<a href='{}' target='_blank'>(Link)".format(short_url)
print(
"<h3>Total ON_QA: {} {}</h3>".format(total_on_qa, link)
)
def report_new_arrivals():
new_bugs = get_new_arrivals()
new_bugs = filter_by_component(new_bugs)
total_new = len(all_bugs(new_bugs))
print(
"<h3>New arrivals (weekly): {}</h3>".format(total_new)
)
for comp, bugs in new_bugs.items():
bug_id_list = []
bugs.sort(key=lambda x: severity[x.bug_severity])
if bugs:
print(
"<u><b><ul style='padding-left:10px;'>Component {} bugs:"
"</ul></b></u>".format(comp, len(bugs))
)
for new_bug in bugs:
print("<li>Bug {} [{}] [{}]: {}</li>".format(
new_bug.bug_id, new_bug.bug_severity, new_bug.status,
new_bug.short_desc
))
bug_id_list.append(str(new_bug.bug_id))
if len(bug_id_list) > 0:
bug_link = get_bug_url_link(bug_ids=bug_id_list)
link = "<a href='{}' target='_blank'>here".format(bug_link)
print("<p> Link to bugs: {}</p>".format(link))
def report_resolved_bugs():
resolved_bugs = get_resolved_bugs()
resolved_bugs = filter_by_component(resolved_bugs)
total_new = len(all_bugs(resolved_bugs))
print(
"<h3>Resolved bugs (weekly): {}</h3>".format(total_new)
)
def report_open_blockers():
open_blockers = get_open_blockers()
open_blockers = filter_by_status(open_blockers, OPEN_BUGS)
open_blockers = filter_by_component(open_blockers)
total_blockers = len(all_bugs(open_blockers))
print(
"<h3>Open Blocker+: {}</h3>".format(total_blockers)
)
for comp, bugs in open_blockers.items():
bug_id_list = []
bugs.sort(key=lambda x: severity[x.bug_severity])
if bugs:
print(
"<u><b><ul style='padding-left:10px;'>Component {} bugs:"
"</ul></b></u>".format(comp, len(bugs))
)
for blocker in bugs:
print("<li>Bug {} [{}] [{}]: {}</li>".format(
blocker.bug_id, blocker.bug_severity, blocker.status,
blocker.short_desc
))
bug_id_list.append(str(blocker.bug_id))
if len(bug_id_list) > 0:
bug_link = get_bug_url_link(bug_ids=bug_id_list)
link = "<a href='{}' target='_blank'>here".format(bug_link)
print("<p> Link to bugs: {}</p>".format(link))
def report_open_candidate_blockers():
open_blockers = get_open_candidate_blockers()
open_blockers = filter_by_status(open_blockers, OPEN_BUGS)
open_blockers = filter_by_component(open_blockers)
total_blockers = len(all_bugs(open_blockers))
print(
"<h3>Open Blocker?: {}</h3>".format(total_blockers)
)
for comp, bugs in open_blockers.items():
bug_id_list = []
bugs.sort(key=lambda x: severity[x.bug_severity])
if bugs:
print("<u><b><ul style='padding-left:10px;'>Component {} bugs:"
"</ul></b></u>".format(comp, len(bugs))
)
for blocker in bugs:
print("<li>Bug {} [{}] [{}]: {}</li>".format(
blocker.bug_id, blocker.bug_severity, blocker.status,
blocker.short_desc
))
bug_id_list.append(str(blocker.bug_id))
if len(bug_id_list) > 0:
bug_link = get_bug_url_link(bug_ids=bug_id_list)
link = "<a href='{}' target='_blank'>here".format(bug_link)
print("<p> Link to bugs: {}</p>".format(link))
def filter_by_component(bugs, verify_status=True):
bugs_by_comp = copy.deepcopy(COMPONENTS)
for bug in bugs:
if verify_status and not (
bug.status in OPEN_BUGS or bug.status in (
VERIFIED or bug.status in ON_QA
)
):
continue
if bug.component in bugs_by_comp:
bugs_by_comp[bug.component].append(bug)
else:
continue
return bugs_by_comp
def filter_by_team(bugs):
bugs_by_team = copy.deepcopy(BUGS_BY_TEAM)
for bug in bugs:
if not (
bug.status in OPEN_BUGS or bug.status in (
VERIFIED or bug.status in ON_QA
)
):
continue
try:
qa_contact = bug.qa_contact_detail['email'].split('@')[0]
if qa_contact in all_members():
for team, members in teams.items():
if qa_contact in members:
bugs_by_team[team].append(bug)
except AttributeError as ex:
print("No needinfo contact for bug {}".format(bug.id))
return bugs_by_team
def filter_by_status(bugs, status):
return [bug for bug in bugs if bug.status in status]
def filter_by_closed_resolution(bugs, resolution):
return [bug for bug in bugs if bug.resolution in resolution]
def filter_by_severity(bugs, severity):
return [bug for bug in bugs if bug.bug_severity in severity]
def report_on_qa_blockers():
def print_report(bugs):
bug_list = []
bugs.sort(key=lambda x: severity[x.bug_severity])
print("<ul style='list-style-type:circle'>")
for bug in bugs:
print(
"<li>Bug {} [{}]: {}</li>".format(
bug.bug_id, bug.bug_severity, bug.short_desc
)
)
bug_list.append(str(bug.id))
print("</ul>")
if len(bug_list) > 0:
short_url = get_bug_url_link(bug_list)
link = "<a href='{}' target='_blank'>here".format(short_url)
print(
"<p>   Link to bugs: {}</p>".format(link)
)
on_qa_blockers = get_on_qa_blockers()
total_on_qa_blockers = len(on_qa_blockers)
bug_id_list = [str(bug.id) for bug in on_qa_blockers]
short_url = get_bug_url_link(bug_id_list)
link = ""
if len(bug_id_list) > 0:
link = "<a href='{}' target='_blank'>(Link)".format(short_url)
print(
"<h3>ON_QA Blocker+: {} {}</h3>".format(total_on_qa_blockers, link)
)
print_report(on_qa_blockers)
def get_needinfos_bugs():
all_team_members = all_members()
all_team_members = ",".join(all_team_members)
query = {
"bug_status" : "",
"classification" : "Red Hat",
"f1" : "requestees.login_name",
"f2" : "flagtypes.name",
"include_fields" : [
"id",
"keywords",
"flags",
"summary",
"flags_all",
"qa_contact",
"qa_contact_realname",
"short_desc",
"short_short_desc",
"status",
"whiteboard",
"changeddate",
"severity",
"target_milestone"
],
"o1" : "anywordssubstr",
"o2" : "substring",
"product" : BUGZILLA_PRODUCT,
"query_format" : "advanced",
"v1" : all_team_members,
"v2" : "needinfo"
}
bugs = bzapi.query(query)
return filter_only_bugs(bugs)
def sort_target_release(bugs):
target_release = {}
for bug in bugs:
if bug.target_milestone in target_release:
target_release[bug.target_milestone].append(bug)
else:
target_release[bug.target_milestone] = [bug]
return target_release
def sort_by_pm_score(bugs):
return sorted(bugs, key=lambda x: int(x.cf_pm_score), reverse=True)
def filter_only_bugs(bug_list):
filtered_list = []
for bug in bug_list:
if "FutureFeature" in bug.keywords or "Improvement" in bug.keywords:
continue
else:
filtered_list.append(bug)
return filtered_list
def get_new_arrivals(version=VERSION, changed_from='-1w', changed_to="Now"):
query = {
"action": "wrap",
"chfield" : "[Bug creation]",
"chfieldfrom" : changed_from,
"chfieldto" : changed_to,
"f3": "OP",
"f6": "CP",
"f7": "component",
"j3": "OR",
"o7": "notsubstring",
"query_format": "advanced",
"target_milestone": "---",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": "documentation",
"version": version
}
bugs = bzapi.query(query)
return filter_only_bugs(bugs)
def get_blocker_arrivals(version=VERSION, changed_from='-1w', changed_to="Now"):
query = {
"bug_status": "",
"chfield": "[Bug creation]",
"chfieldfrom": changed_from,
"chfieldto": changed_to,
"f3": "OP",
"f6": "CP",
"f7": "flagtypes.name",
"j3": "OR",
"o7": "substring",
"query_format" : "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": "blocker",
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"version": version
}
bugs = bzapi.query(query)
return filter_only_bugs(bugs)
def get_resolved_bugs(
version=BUGZILLA_VERSION_FLAG, changed_from='-1w', changed_to="Now"
):
query = {
"bug_status": "",
"chfield": "bug_status",
"chfieldfrom": changed_from,
"chfieldto": changed_to,
"chfieldvalue": "ON_QA",
"classification": "Red Hat",
"f3": "OP",
"f6": "CP",
"f7": "component",
"o7": "notsubstring",
"v7": "documentation",
"j3": "OR",
"product": BUGZILLA_PRODUCT,
"query_format": "advanced",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version,
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, [ON_QA, VERIFIED])
return filter_only_bugs(bugs)
def get_qe_backlog():
query = {
"bug_status": "ON_QA",
"f3": "OP",
"f6": "CP",
"f7": "flagtypes.name",
"j3": "OR",
"o7": "substring",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": BUGZILLA_VERSION_FLAG,
"include_fields": [
"id",
"status",
"qa_contact",
"severity"
],
}
bugs = bzapi.query(query)
return bugs
def get_bugs_per_member(
member_name, product='', version="",
):
query = {
"bug_status": "ON_QA",
"classification": "Red Hat",
"product": product,
"emailqa_contact1": "1",
"emailtype1": "substring",
"f2": "qa_contact",
"include_fields": [
"id",
"status",
"severity"
],
"o2": "equals",
"query_format": "advanced",
"v2": f"{member_name}@redhat.com",
"f7": "flagtypes.name",
"o7": "substring",
"v7": version,
}
bugs = bzapi.query(query)
return bugs
def get_dev_backlog(version):
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED,ON_DEV",
"f3": "OP",
"f6": "CP",
"f7": "component",
"f8": "flagtypes.name",
"j3": "OR",
"n7": "1",
"o7": "equals",
"o8": "substring",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": "documentation",
"v8": version,
"include_fields": [
"id",
"status",
"cf_pm_score",
"summary",
"status",
"component",
"severity",
"creation_time",
"keywords",
],
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_critical_bugs(version=VERSION):
bugs = []
query = {
"bug_severity": "urgent",
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f6": "CP",
"j3": "OR",
"keywords": "FutureFeature, Improvement, ",
"keywords_type": "nowords",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"version": version,
"include_fields": [
"id",
"status",
],
}
urgent_bugs = bzapi.query(query)
bugs += filter_by_status(urgent_bugs, OPEN_BUGS_LIST)
return bugs
def get_regression_bugs(version=VERSION):
query = {
"action": "wrap",
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f6": "CP",
"f7": "keywords",
"j3": "OR",
"o7": "anywordssubstr",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": "Regression",
"version": version,
"include_fields": [
"id",
"status",
],
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_untriaged_bugs(version_flag):
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING",
"f3": "OP",
"f6": "CP",
"f7": "flagtypes.name",
"f8": "component",
"j3": "OR",
"n8": "1",
"o7": "regexp",
"o8": "substring",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": f'{version_flag}.*[?]',
"v8": "Documentation",
"include_fields": [
"id",
"status",
],
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, [
"NEW", "ASSIGNED", "POST", "MODIFIED", "ON_DEV", "ON_QA",
"VERIFIED", "RELEASE_PENDING"
])
return bugs
def get_doc_bugs():
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED,ON_DEV",
"f3": "OP",
"f6": "CP",
"f7": "component",
"f8": "flagtypes.name",
"f9": "keywords",
"j3": "OR",
"o7": "equals",
"o8": "substring",
"o9": "notsubstring",
"query_format": "advanced",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"v7": "documentation",
"v8": BUGZILLA_VERSION_FLAG,
"v9": "Tracking",
"include_fields": [
"id",
"status",
],
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_performance_blockers():
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"classification": "Red Hat",
"f3": "OP",
"f6": "CP",
"j5": "OR",
"keywords": "TestBlocker, Performance, ",
"keywords_type": "allwords",
"product": BUGZILLA_PRODUCT,
"query_format": "advanced"
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_scale_blockers():
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"classification": "Red Hat",
"product": BUGZILLA_PRODUCT,
"f3": "OP",
"f6": "CP",
"f7": "cf_qa_whiteboard",
"keywords": "TestBlocker,",
"keywords_type": "allwords",
"o7": "substring",
"query_format": "advanced",
"v7": "Scale"
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_overall_backlog(version=''):
query = {
"action": "wrap",
"bug_status": "NEW,ASSIGNED,POST,MODIFIED,ON_DEV",
"f3": "OP",
"f4": "product",
"f6": "CP",
"j3": "OR",
"o4": "equals",
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"query_format": "advanced",
"product": BUGZILLA_PRODUCT,
}
if version:
query['f7'] = "flagtypes.name"
query['o7'] = 'substring'
query['v7'] = version
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_all_bugs_in_version(version=''):
query = {
"action": "wrap",
"classification": "Red Hat",
"bug_status": "__open__,__closed__",
"f3": "OP",
"f6": "CP",
"j3": "OR",
"query_format": "advanced",
"product": BUGZILLA_PRODUCT,
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"version": version,
"include_fields": [
"id",
"status",
"resolution"
],
}
bugs = bzapi.query(query)
bugs = filter_by_closed_resolution(bugs, CLOSED_RESOLUTION)
return bugs
def get_all_bugs_targeted_to_version(version=BUGZILLA_VERSION_FLAG):
query = {
"action": "wrap",
"classification": "Red Hat",
"bug_status": "__open__,__closed__",
"f3": "OP",
"f6": "CP",
"j3": "OR",
"query_format": "advanced",
"product": BUGZILLA_PRODUCT,
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version,
"include_fields": [
"id",
"status",
"resolution"
],
}
bugs = bzapi.query(query)
bugs = filter_by_closed_resolution(bugs, CLOSED_RESOLUTION)
return bugs
def get_all_regression_bugs(version=''):
query = {
"action": "wrap",
"bug_status": "__open__,__closed__",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "keywords",
"j3": "OR",
"o4": "equals",
"o7": "anywordssubstr",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "Regression",
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"version": version,
"include_fields": [
"id",
"status",
"resolution"
],
}
bugs = bzapi.query(query)
bugs = filter_by_closed_resolution(bugs, CLOSED_RESOLUTION)
return bugs
def get_all_failedqa_bugs(version=''):
query = {
"action": "wrap",
"bug_status": "__open__,__closed__",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "cf_verified",
"j3": "OR",
"o4": "equals",
"o7": "substring",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "FailedQA",
"f8": "component",
"o8": "notsubstring",
"v8": "documentation",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version,
"include_fields": [
"id",
"status",
"resolution"
],
}
bugs = bzapi.query(query)
bugs = filter_by_closed_resolution(bugs, CLOSED_RESOLUTION)
return bugs
def get_all_verified_bugs(version=''):
query = {
"bug_status": "VERIFIED,RELEASE_PENDING,CLOSED",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "bug_status",
"j3": "OR",
"o4": "equals",
"o7": "changedto",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "VERIFIED",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version,
"include_fields": [
"id",
"status",
],
}
bugs = bzapi.query(query)
return bugs
def get_verified_bugs(
version=BUGZILLA_VERSION_FLAG, changed_from='-1w', changed_to='Now'
):
query = {
"bug_status": "",
"chfield": "bug_status",
"chfieldfrom": changed_from,
"chfieldto": changed_to,
"chfieldvalue": "VERIFIED",
"classification": "Red Hat",
"f3": "OP",
"f6": "CP",
"j3": "OR",
"product": BUGZILLA_PRODUCT,
"query_format": "advanced",
"include_fields": [
"id",
"status",
],
"f9": "flagtypes.name",
"o9": "substring",
"v9": version
}
bugs = bzapi.query(query)
return bugs
def get_changed_bugs_in_the_past_x_time(time='-1h'):
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED,ON_DEV,VERIFIED,ON_QA,RELEASE_PENDING",
"classification": "Red Hat",
"f3": "OP",
"f6": "CP",
"f9": "delta_ts",
"j3": "OR",
"o9": "greaterthan",
"product": BUGZILLA_PRODUCT,
"query_format": "advanced",
"v9": time
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, [
"NEW", "ASSIGNED", "POST", "MODIFIED", "ON_DEV", "VERIFIED", "ON_QA",
"RELEASE_PENDING"
])
return bugs
def get_quality_score(bug):
qa_wb = bug.cf_qa_whiteboard
if QUALITY_IMPACT in qa_wb:
score_idx = int(qa_wb.find(QUALITY_IMPACT) + len(QUALITY_IMPACT))
return int(qa_wb[score_idx:score_idx + 3])
return -1
def get_all_ready_for_testing_bugs(version=''):
query = {
"bug_status": "",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "bug_status",
"j3": "OR",
"keywords": "Reopened",
"keywords_type": "nowords",
"o4": "equals",
"o7": "changedto",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "ON_QA",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version,
"include_fields": [
"id",
"status",
],
}
bugs = bzapi.query(query)
return bugs
def get_on_qa_bugs():
query = BASE_QUERY.copy()
query['bug_status'] = ON_QA
bugs = bzapi.query(query)
return filter_only_bugs(bugs)
def get_open_blockers():
query = {
"action": "wrap",
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f8": "flagtypes.name",
"f9": "flagtypes.name",
"j3": "OR",
"o4": "equals",
"o8": "anywordssubstr",
"o9": "substring",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v8": "blocker+",
"v9": BUGZILLA_VERSION_FLAG
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_open_candidate_blockers():
query = {
"action": "wrap",
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f8": "flagtypes.name",
"f9": "flagtypes.name",
"j3": "OR",
"o4": "equals",
"o8": "anywordssubstr",
"o9": "substring",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v8": "blocker?",
"v9": BUGZILLA_VERSION_FLAG
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_on_qa_blockers():
query = BASE_QUERY.copy()
query['bug_status'] = ON_QA
query['v8'] = BLOCKER
bugs = bzapi.query(query)
return filter_only_bugs(bugs)
def get_deployment_blockers(version=BUGZILLA_VERSION_FLAG):
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "cf_qa_whiteboard",
"j3": "OR",
"o4": "equals",
"o7": "anywordssubstr",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "Deployment_blocker",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version
}
bugs = bzapi.query(query)
bugs = filter_by_status(bugs, OPEN_BUGS_LIST)
return bugs
def get_feature_blockers(version=BUGZILLA_VERSION_FLAG):
query = {
"bug_status": "NEW,ASSIGNED,POST,MODIFIED",
"f3": "OP",
"f4": "product",
"f6": "CP",
"f7": "cf_qa_whiteboard",
"j3": "OR",
"o4": "equals",
"o7": "anywordssubstr",
"query_format": "advanced",
"v4": BUGZILLA_PRODUCT,
"v7": "Feature_blocker",
"f9": "flagtypes.name",
"o9": "substring",
"v9": version
}