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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
|
# 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/.
import itertools
import logging
import os
import re
from datetime import datetime, timedelta
from redo import retry
from taskgraph.parameters import Parameters
from taskgraph.target_tasks import _target_task, get_method
from taskgraph.util.taskcluster import find_task_id
from gecko_taskgraph import GECKO, try_option_syntax
from gecko_taskgraph.util.attributes import (
match_run_on_hg_branches,
match_run_on_projects,
)
from gecko_taskgraph.util.hg import find_hg_revision_push_info, get_hg_commit_message
from gecko_taskgraph.util.platforms import platform_family
logger = logging.getLogger(__name__)
# Some tasks show up in the target task set, but are possibly special cases,
# uncommon tasks, or tasks running against limited hardware set that they
# should only be selectable with --full.
UNCOMMON_TRY_TASK_LABELS = [
# Platforms and/or Build types
r"build-.*-gcp", # Bug 1631990
r"mingwclang", # Bug 1631990
r"valgrind", # Bug 1631990
# Android tasks
r"android-geckoview-docs",
r"android-hw",
# Windows tasks
r"windows11-64-2009-hw-ref",
r"windows10-aarch64-qr",
# Linux tasks
r"linux-", # hide all linux32 tasks by default - bug 1599197
r"linux1804-32", # hide linux32 tests - bug 1599197
# Test tasks
r"web-platform-tests.*backlog", # hide wpt jobs that are not implemented yet - bug 1572820
r"-ccov",
r"-profiling-", # talos/raptor profiling jobs are run too often
r"-32-.*-webgpu", # webgpu gets little benefit from these tests.
r"-asan-.*-webgpu",
r"-tsan-.*-webgpu",
# Hide shippable versions of tests we have opt versions of because the non-shippable
# versions are faster to run. This is mostly perf tests.
r"-shippable(?!.*(awsy|browsertime|marionette-headless|mochitest-devtools-chrome-fis|raptor|talos|web-platform-tests-wdspec-headless|mochitest-plain-headless))", # noqa - too long
r"nightly-simulation",
# Can't actually run on try
r"notarization",
]
def index_exists(index_path, reason=""):
print(f"Looking for existing index {index_path} {reason}...")
try:
task_id = find_task_id(index_path)
print(f"Index {index_path} exists: taskId {task_id}")
return True
except KeyError:
print(f"Index {index_path} doesn't exist.")
return False
def filter_out_shipping_phase(task, parameters):
return (
# nightly still here because of geckodriver
not task.attributes.get("nightly")
and task.attributes.get("shipping_phase") in (None, "build")
)
def filter_out_devedition(task, parameters):
return not task.attributes.get("shipping_product") == "devedition"
def filter_out_cron(task, parameters):
"""
Filter out tasks that run via cron.
"""
return not task.attributes.get("cron")
def filter_for_project(task, parameters):
"""Filter tasks by project. Optionally enable nightlies."""
run_on_projects = set(task.attributes.get("run_on_projects", []))
return match_run_on_projects(parameters["project"], run_on_projects)
def filter_for_hg_branch(task, parameters):
"""Filter tasks by hg branch.
If `run_on_hg_branch` is not defined, then task runs on all branches"""
run_on_hg_branches = set(task.attributes.get("run_on_hg_branches", ["all"]))
return match_run_on_hg_branches(parameters["hg_branch"], run_on_hg_branches)
def filter_on_platforms(task, platforms):
"""Filter tasks on the given platform"""
platform = task.attributes.get("build_platform")
return platform in platforms
def filter_by_uncommon_try_tasks(task, optional_filters=None):
"""Filters tasks that should not be commonly run on try.
Args:
task (str): String representing the task name.
optional_filters (list, optional):
Additional filters to apply to task filtering.
Returns:
(Boolean): True if task does not match any known filters.
False otherwise.
"""
filters = UNCOMMON_TRY_TASK_LABELS
if optional_filters:
filters = itertools.chain(filters, optional_filters)
return not any(re.search(pattern, task) for pattern in filters)
def filter_by_regex(task_label, regexes, mode="include"):
"""Filters tasks according to a list of pre-compiled reguar expressions.
If mode is "include", a task label must match any regex to pass.
If it is "exclude", a task label must _not_ match any regex to pass.
"""
if not regexes:
return True
assert mode in ["include", "exclude"]
any_match = any(r.search(task_label) for r in regexes)
if any_match:
return mode == "include"
return mode != "include"
def filter_release_tasks(task, parameters):
platform = task.attributes.get("build_platform")
if platform in (
"linux",
"linux64",
"macosx64",
"win32",
"win64",
"win64-aarch64",
):
if task.attributes["kind"] == "l10n":
# This is on-change l10n
return True
if (
task.attributes["build_type"] == "opt"
and task.attributes.get("unittest_suite") != "talos"
and task.attributes.get("unittest_suite") != "raptor"
):
return False
if task.attributes.get("shipping_phase") not in (None, "build"):
return False
""" No debug on release, keep on ESR with 4 week cycles, release
will not be too different from central, but ESR will live for a long time.
From June 2019 -> June 2020, we found 1 unique regression on ESR debug
and 5 unique regressions on beta/release. Keeping spidermonkey and linux
debug finds all but 1 unique regressions (windows found on try) for beta/release.
...but debug-only failures started showing up on ESR (esr-91, esr-102) so
desktop debug tests were added back for beta.
"""
build_type = task.attributes.get("build_type", "")
build_platform = task.attributes.get("build_platform", "")
test_platform = task.attributes.get("test_platform", "")
if parameters["release_type"].startswith("esr") or (
parameters["release_type"] == "beta" and "android" not in build_platform
):
return True
# code below here is intended to reduce release debug tasks
if task.kind == "hazard" or "toolchain" in build_platform:
# keep hazard and toolchain builds around
return True
if build_type == "debug":
if "linux" not in build_platform:
# filter out windows/mac/android
return False
if task.kind not in ["spidermonkey"] and "-qr" in test_platform:
# filter out linux-qr tests, leave spidermonkey
return False
if "64" not in build_platform:
# filter out linux32 builds
return False
# webrender-android-*-debug doesn't have attributes to find 'debug', using task.label.
if task.kind == "webrender" and "debug" in task.label:
return False
return True
def filter_out_missing_signoffs(task, parameters):
for signoff in parameters["required_signoffs"]:
if signoff not in parameters["signoff_urls"] and signoff in task.attributes.get(
"required_signoffs", []
):
return False
return True
def filter_tests_without_manifests(task, parameters):
"""Remove test tasks that have an empty 'test_manifests' attribute.
This situation can arise when the test loader (e.g bugbug) decided there
weren't any important manifests to run for the given push. We filter tasks
out here rather than in the transforms so that the full task graph is still
aware that the task exists (which is needed by the backfill action).
"""
if (
task.kind == "test"
and "test_manifests" in task.attributes
and not task.attributes["test_manifests"]
):
return False
return True
def standard_filter(task, parameters):
return all(
filter_func(task, parameters)
for filter_func in (
filter_out_cron,
filter_for_project,
filter_for_hg_branch,
filter_tests_without_manifests,
)
)
def accept_raptor_android_build(platform):
"""Helper function for selecting the correct android raptor builds."""
if "android" not in platform:
return False
if "shippable" not in platform:
return False
if "p5" in platform and "aarch64" in platform:
return False
if "p6" in platform and "aarch64" in platform:
return True
if "s21" in platform and "aarch64" in platform:
return True
if "a51" in platform:
return True
return False
def accept_raptor_desktop_build(platform):
"""Helper function for selecting correct desktop raptor builds."""
if "android" in platform:
return False
# ignore all windows 7 perf jobs scheduled automatically
if "windows7" in platform or "windows10-32" in platform:
return False
# Completely ignore all non-shippable platforms
if "shippable" in platform:
return True
return False
def accept_awsy_task(try_name, platform):
if accept_raptor_desktop_build(platform):
if "windows" in platform and "windows11-64" not in platform:
return False
if "dmd" in try_name:
return False
if "awsy-base" in try_name:
return True
if "awsy-tp6" in try_name:
return True
return False
def filter_unsupported_artifact_builds(task, parameters):
try_config = parameters.get("try_task_config", {})
if not try_config.get("use-artifact-builds", False):
return True
supports_artifact_builds = task.attributes.get("supports-artifact-builds", True)
return supports_artifact_builds
def filter_out_shippable(task):
return not task.attributes.get("shippable", False)
def _try_task_config(full_task_graph, parameters, graph_config):
requested_tasks = parameters["try_task_config"]["tasks"]
pattern_tasks = [x for x in requested_tasks if x.endswith("-*")]
tasks = list(set(requested_tasks) - set(pattern_tasks))
matched_tasks = []
missing = set()
for pattern in pattern_tasks:
found = [
t
for t in full_task_graph.graph.nodes
if t.split(pattern.replace("*", ""))[-1].isnumeric()
]
if found:
matched_tasks.extend(found)
else:
missing.add(pattern)
if "MOZHARNESS_TEST_PATHS" in parameters["try_task_config"].get("env", {}):
matched_tasks = [x for x in matched_tasks if x.endswith("-1")]
selected_tasks = set(tasks) | set(matched_tasks)
missing.update(selected_tasks - set(full_task_graph.tasks))
if missing:
missing_str = "\n ".join(sorted(missing))
logger.warning(
f"The following tasks were requested but do not exist in the full task graph and will be skipped:\n {missing_str}"
)
return list(selected_tasks - missing)
def _try_option_syntax(full_task_graph, parameters, graph_config):
"""Generate a list of target tasks based on try syntax in
parameters['message'] and, for context, the full task graph."""
options = try_option_syntax.TryOptionSyntax(
parameters, full_task_graph, graph_config
)
target_tasks_labels = [
t.label
for t in full_task_graph.tasks.values()
if options.task_matches(t)
and filter_by_uncommon_try_tasks(t.label)
and filter_unsupported_artifact_builds(t, parameters)
]
attributes = {
k: getattr(options, k)
for k in [
"no_retry",
"tag",
]
}
for l in target_tasks_labels:
task = full_task_graph[l]
if "unittest_suite" in task.attributes:
task.attributes["task_duplicates"] = options.trigger_tests
for l in target_tasks_labels:
task = full_task_graph[l]
# If the developer wants test jobs to be rebuilt N times we add that value here
if options.trigger_tests > 1 and "unittest_suite" in task.attributes:
task.attributes["task_duplicates"] = options.trigger_tests
# If the developer wants test talos jobs to be rebuilt N times we add that value here
if (
options.talos_trigger_tests > 1
and task.attributes.get("unittest_suite") == "talos"
):
task.attributes["task_duplicates"] = options.talos_trigger_tests
# If the developer wants test raptor jobs to be rebuilt N times we add that value here
if (
options.raptor_trigger_tests
and options.raptor_trigger_tests > 1
and task.attributes.get("unittest_suite") == "raptor"
):
task.attributes["task_duplicates"] = options.raptor_trigger_tests
task.attributes.update(attributes)
# Add notifications here as well
if options.notifications:
for task in full_task_graph:
owner = parameters.get("owner")
routes = task.task.setdefault("routes", [])
if options.notifications == "all":
routes.append(f"notify.email.{owner}.on-any")
elif options.notifications == "failure":
routes.append(f"notify.email.{owner}.on-failed")
routes.append(f"notify.email.{owner}.on-exception")
return target_tasks_labels
@_target_task("try_tasks")
def target_tasks_try(full_task_graph, parameters, graph_config):
try_mode = parameters["try_mode"]
if try_mode == "try_task_config":
return _try_task_config(full_task_graph, parameters, graph_config)
if try_mode == "try_option_syntax":
return _try_option_syntax(full_task_graph, parameters, graph_config)
# With no try mode, we schedule nothing, allowing the user to add tasks
# later via treeherder.
return []
@_target_task("try_select_tasks")
def target_tasks_try_select(full_task_graph, parameters, graph_config):
tasks = target_tasks_try_select_uncommon(full_task_graph, parameters, graph_config)
return [l for l in tasks if filter_by_uncommon_try_tasks(l)]
@_target_task("try_select_tasks_uncommon")
def target_tasks_try_select_uncommon(full_task_graph, parameters, graph_config):
from gecko_taskgraph.decision import PER_PROJECT_PARAMETERS
projects = ("autoland", "mozilla-central")
if parameters["project"] not in projects:
projects = (parameters["project"],)
tasks = set()
for project in projects:
params = dict(parameters)
params["project"] = project
parameters = Parameters(**params)
try:
target_tasks_method = PER_PROJECT_PARAMETERS[project]["target_tasks_method"]
except KeyError:
target_tasks_method = "default"
tasks.update(
get_method(target_tasks_method)(full_task_graph, parameters, graph_config)
)
return sorted(tasks)
@_target_task("try_auto")
def target_tasks_try_auto(full_task_graph, parameters, graph_config):
"""Target the tasks which have indicated they should be run on autoland
(rather than try) via the `run_on_projects` attributes.
Should do the same thing as the `default` target tasks method.
"""
params = dict(parameters)
params["project"] = "autoland"
parameters = Parameters(**params)
regex_filters = parameters["try_task_config"].get("tasks-regex")
include_regexes = exclude_regexes = []
if regex_filters:
include_regexes = [re.compile(r) for r in regex_filters.get("include", [])]
exclude_regexes = [re.compile(r) for r in regex_filters.get("exclude", [])]
return [
l
for l, t in full_task_graph.tasks.items()
if standard_filter(t, parameters)
and filter_out_shipping_phase(t, parameters)
and filter_out_devedition(t, parameters)
and filter_by_uncommon_try_tasks(t.label)
and filter_by_regex(t.label, include_regexes, mode="include")
and filter_by_regex(t.label, exclude_regexes, mode="exclude")
and filter_unsupported_artifact_builds(t, parameters)
and filter_out_shippable(t)
]
@_target_task("default")
def target_tasks_default(full_task_graph, parameters, graph_config):
"""Target the tasks which have indicated they should be run on this project
via the `run_on_projects` attributes."""
return [
l
for l, t in full_task_graph.tasks.items()
if standard_filter(t, parameters)
and filter_out_shipping_phase(t, parameters)
and filter_out_devedition(t, parameters)
]
@_target_task("autoland_tasks")
def target_tasks_autoland(full_task_graph, parameters, graph_config):
"""In addition to doing the filtering by project that the 'default'
filter does, also remove any tests running against shippable builds
for non-backstop pushes."""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task):
if task.kind != "test":
return True
if parameters["backstop"]:
return True
build_type = task.attributes.get("build_type")
if not build_type or build_type != "opt" or filter_out_shippable(task):
return True
return False
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@_target_task("mozilla_central_tasks")
def target_tasks_mozilla_central(full_task_graph, parameters, graph_config):
"""In addition to doing the filtering by project that the 'default'
filter does, also remove any tests running against regular (aka not shippable,
asan, etc.) opt builds."""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task):
if task.kind != "test":
return True
build_platform = task.attributes.get("build_platform")
build_type = task.attributes.get("build_type")
shippable = task.attributes.get("shippable", False)
if not build_platform or not build_type:
return True
family = platform_family(build_platform)
# We need to know whether this test is against a "regular" opt build
# (which is to say, not shippable, asan, tsan, or any other opt build
# with other properties). There's no positive test for this, so we have to
# do it somewhat hackily. Android doesn't have variants other than shippable
# so it is pretty straightforward to check for. Other platforms have many
# variants, but none of the regular opt builds we're looking for have a "-"
# in their platform name, so this works (for now).
is_regular_opt = (
family == "android" and not shippable
) or "-" not in build_platform
if build_type != "opt" or not is_regular_opt:
return True
return False
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@_target_task("graphics_tasks")
def target_tasks_graphics(full_task_graph, parameters, graph_config):
"""In addition to doing the filtering by project that the 'default'
filter does, also remove artifact builds because we have csets on
the graphics branch that aren't on the candidate branches of artifact
builds"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task):
if task.attributes["kind"] == "artifact-build":
return False
return True
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@_target_task("mozilla_beta_tasks")
def target_tasks_mozilla_beta(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a promotable beta or release build
of desktop, plus android CI. The candidates build process involves a pipeline
of builds and signing, but does not include beetmover or balrog jobs."""
return [
l
for l, t in full_task_graph.tasks.items()
if filter_release_tasks(t, parameters) and standard_filter(t, parameters)
]
@_target_task("mozilla_release_tasks")
def target_tasks_mozilla_release(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a promotable beta or release build
of desktop, plus android CI. The candidates build process involves a pipeline
of builds and signing, but does not include beetmover or balrog jobs."""
return [
l
for l, t in full_task_graph.tasks.items()
if filter_release_tasks(t, parameters) and standard_filter(t, parameters)
]
@_target_task("mozilla_esr115_tasks")
def target_tasks_mozilla_esr115(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a promotable beta or release build
of desktop, without android CI. The candidates build process involves a pipeline
of builds and signing, but does not include beetmover or balrog jobs."""
def filter(task):
if not filter_release_tasks(task, parameters):
return False
if not standard_filter(task, parameters):
return False
platform = task.attributes.get("build_platform")
# Android is not built on esr115.
if platform and "android" in platform:
return False
return True
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("promote_desktop")
def target_tasks_promote_desktop(full_task_graph, parameters, graph_config):
"""Select the superset of tasks required to promote a beta or release build
of a desktop product. This should include all non-android
mozilla_{beta,release} tasks, plus l10n, beetmover, balrog, etc."""
def filter(task):
if task.attributes.get("shipping_product") != parameters["release_product"]:
return False
# 'secondary' balrog/update verify/final verify tasks only run for RCs
if parameters.get("release_type") != "release-rc":
if "secondary" in task.kind:
return False
if not filter_out_missing_signoffs(task, parameters):
return False
if task.attributes.get("shipping_phase") == "promote":
return True
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("push_desktop")
def target_tasks_push_desktop(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to push a build of desktop to cdns.
Previous build deps will be optimized out via action task."""
filtered_for_candidates = target_tasks_promote_desktop(
full_task_graph,
parameters,
graph_config,
)
def filter(task):
if not filter_out_missing_signoffs(task, parameters):
return False
# Include promotion tasks; these will be optimized out
if task.label in filtered_for_candidates:
return True
if (
task.attributes.get("shipping_product") == parameters["release_product"]
and task.attributes.get("shipping_phase") == "push"
):
return True
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("ship_desktop")
def target_tasks_ship_desktop(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to ship desktop.
Previous build deps will be optimized out via action task."""
is_rc = parameters.get("release_type") == "release-rc"
if is_rc:
# ship_firefox_rc runs after `promote` rather than `push`; include
# all promote tasks.
filtered_for_candidates = target_tasks_promote_desktop(
full_task_graph,
parameters,
graph_config,
)
else:
# ship_firefox runs after `push`; include all push tasks.
filtered_for_candidates = target_tasks_push_desktop(
full_task_graph,
parameters,
graph_config,
)
def filter(task):
if not filter_out_missing_signoffs(task, parameters):
return False
# Include promotion tasks; these will be optimized out
if task.label in filtered_for_candidates:
return True
if (
task.attributes.get("shipping_product") != parameters["release_product"]
or task.attributes.get("shipping_phase") != "ship"
):
return False
if "secondary" in task.kind:
return is_rc
return not is_rc
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("pine_tasks")
def target_tasks_pine(full_task_graph, parameters, graph_config):
"""Bug 1879960 - no reftests or wpt needed"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task):
suite = task.attributes.get("unittest_suite", "")
if "reftest" in suite or "web-platform" in suite:
return False
return True
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@_target_task("larch_tasks")
def target_tasks_larch(full_task_graph, parameters, graph_config):
"""Bug 1879213 - only run necessary tasks on larch"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task):
# no localized builds, no android
if (
"l10n" in task.kind
or "msix" in task.kind
or "android" in task.attributes.get("build_platform", "")
or (task.kind == "test" and "msix" in task.label)
):
return False
# otherwise reduce tests only
if task.kind != "test":
return True
return "browser-chrome" in task.label or "xpcshell" in task.label
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@_target_task("kaios_tasks")
def target_tasks_kaios(full_task_graph, parameters, graph_config):
"""The set of tasks to run for kaios integration"""
def filter(task):
# We disable everything in central, and adjust downstream.
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("custom-car_perf_testing")
def target_tasks_custom_car_perf_testing(full_task_graph, parameters, graph_config):
"""Select tasks required for running daily performance tests for custom chromium-as-release."""
def filter(task):
platform = task.attributes.get("test_platform")
attributes = task.attributes
if attributes.get("unittest_suite") != "raptor":
return False
try_name = attributes.get("raptor_try_name")
# Desktop and Android selection for CaR
if accept_raptor_desktop_build(platform) or accept_raptor_android_build(
platform
):
if "browsertime" in try_name and (
"custom-car" in try_name or "cstm-car-m" in try_name
):
if "hw-s21" in platform and "speedometer3" not in try_name:
return False
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("general_perf_testing")
def target_tasks_general_perf_testing(full_task_graph, parameters, graph_config):
"""
Select tasks required for running performance tests 3 times a week.
"""
def filter(task):
platform = task.attributes.get("test_platform")
attributes = task.attributes
if attributes.get("unittest_suite") != "raptor":
return False
try_name = attributes.get("raptor_try_name")
if "tp6-bench" in try_name:
return False
if "tp7" in try_name:
return False
# Bug 1867669 - Temporarily disable all live site tests
if "live" in try_name and "sheriffed" not in try_name:
return False
# Desktop selection
if accept_raptor_desktop_build(platform):
# Select some browsertime tasks as desktop smoke-tests
if "browsertime" in try_name:
if "chrome" in try_name:
if "tp6" in try_name and "essential" not in try_name:
return False
return True
# chromium-as-release has its own cron
if "custom-car" in try_name:
return False
if "-live" in try_name:
return True
if "-fis" in try_name:
return False
if "linux" in platform:
if "speedometer" in try_name:
return True
if "safari" and "benchmark" in try_name:
return True
# Android selection
elif accept_raptor_android_build(platform):
if "hw-s21" in platform and "speedometer3" not in try_name:
return False
if "chrome-m" in try_name and (
("ebay" in try_name and "live" not in try_name)
or (
"live" in try_name
and ("facebook" in try_name or "dailymail" in try_name)
)
):
return False
# Ignore all fennec tests here, we run those weekly
if "fennec" in try_name:
return False
# Only run webrender tests
if "chrome-m" not in try_name and "-qr" not in platform:
return False
# Select live site tests
if "-live" in try_name:
return True
# Select fenix resource usage tests
if "fenix" in try_name:
# Bug 1816421 disable fission perf tests
if "-fis" in try_name:
return False
if "-power" in try_name:
return True
# Select geckoview resource usage tests
if "geckoview" in try_name:
# Bug 1816421 disable fission perf tests
if "-fis" in try_name:
return False
# Run cpu+memory, and power tests
cpu_n_memory_task = "-cpu" in try_name and "-memory" in try_name
power_task = "-power" in try_name
# Ignore cpu+memory+power tests
if power_task and cpu_n_memory_task:
return False
if cpu_n_memory_task:
return False
if power_task:
return "browsertime" in try_name
# Select browsertime-specific tests
if "browsertime" in try_name:
# Don't run android CaR sp tests as we already have a cron for this.
if "m-car" in try_name:
return False
if "fenix" in try_name:
return False
if "speedometer" in try_name:
return True
if "motionmark" in try_name and "1-3" in try_name:
if "chrome-m" in try_name:
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
def make_desktop_nightly_filter(platforms):
"""Returns a filter that gets all nightly tasks on the given platform."""
def filter(task, parameters):
return all(
[
filter_on_platforms(task, platforms),
filter_for_project(task, parameters),
task.attributes.get("shippable", False),
# Tests and nightly only builds don't have `shipping_product` set
task.attributes.get("shipping_product")
in {None, "firefox", "thunderbird"},
task.kind not in {"l10n"}, # no on-change l10n
]
)
return filter
@_target_task("sp-perftests")
def target_tasks_speedometer_tests(full_task_graph, parameters, graph_config):
def filter(task):
platform = task.attributes.get("test_platform")
attributes = task.attributes
if attributes.get("unittest_suite") != "raptor":
return False
if accept_raptor_desktop_build(platform) or accept_raptor_android_build(
platform
):
try_name = attributes.get("raptor_try_name")
if "hw-s21" in platform and "speedometer3" not in try_name:
return False
if (
"browsertime" in try_name
and "speedometer" in try_name
and "chrome" in try_name
):
return True
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("nightly_linux")
def target_tasks_nightly_linux(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of linux. The
nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter(
{"linux64-shippable", "linux-shippable", "linux64-aarch64-shippable"}
)
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("nightly_macosx")
def target_tasks_nightly_macosx(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of macosx. The
nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"macosx64-shippable"})
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("nightly_win32")
def target_tasks_nightly_win32(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win32-shippable"})
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("nightly_win64")
def target_tasks_nightly_win64(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win64-shippable"})
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("nightly_win64_aarch64")
def target_tasks_nightly_win64_aarch64(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win64-aarch64-shippable"})
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("nightly_asan")
def target_tasks_nightly_asan(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of asan. The
nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter(
{"linux64-asan-reporter-shippable", "win64-asan-reporter-shippable"}
)
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("daily_releases")
def target_tasks_daily_releases(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to identify if we should release.
If we determine that we should the task will communicate to ship-it to
schedule the release itself."""
def filter(task):
return task.kind in ["maybe-release"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("nightly_desktop")
def target_tasks_nightly_desktop(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of linux, mac,
windows."""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-desktop"
)
if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={
"reason": "to avoid triggering multiple nightlies off the same revision",
},
):
return []
# Tasks that aren't platform specific
release_filter = make_desktop_nightly_filter({None})
release_tasks = [
l for l, t in full_task_graph.tasks.items() if release_filter(t, parameters)
]
# Avoid duplicate tasks.
return list(
set(target_tasks_nightly_win32(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_win64(full_task_graph, parameters, graph_config))
| set(
target_tasks_nightly_win64_aarch64(
full_task_graph, parameters, graph_config
)
)
| set(target_tasks_nightly_macosx(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_linux(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_asan(full_task_graph, parameters, graph_config))
| set(release_tasks)
)
@_target_task("nightly_all")
def target_tasks_nightly_all(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of firefox desktop and android"""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-all"
)
if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={
"reason": "to avoid triggering multiple nightlies off the same revision",
},
):
return []
return list(
set(target_tasks_nightly_desktop(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_android(full_task_graph, parameters, graph_config))
)
# Run Searchfox analysis once daily.
@_target_task("searchfox_index")
def target_tasks_searchfox(full_task_graph, parameters, graph_config):
"""Select tasks required for indexing Firefox for Searchfox web site each day"""
return [
"searchfox-linux64-searchfox/debug",
"searchfox-macosx64-searchfox/debug",
"searchfox-win64-searchfox/debug",
"searchfox-android-armv7-searchfox/debug",
"searchfox-ios-searchfox/debug",
"source-test-file-metadata-bugzilla-components",
"source-test-file-metadata-test-info-all",
"source-test-wpt-metadata-summary",
]
# Run build linux64-plain-clang-trunk/opt on mozilla-central/beta with perf tests
@_target_task("linux64_clang_trunk_perf")
def target_tasks_build_linux64_clang_trunk_perf(
full_task_graph, parameters, graph_config
):
"""Select tasks required to run perf test on linux64 build with clang trunk"""
# Only keep tasks generated from platform `linux1804-64-clang-trunk-qr/opt`
def filter(task_label):
if "linux1804-64-clang-trunk-qr/opt" in task_label:
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t.label)]
# Run Updatebot's cron job 4 times daily.
@_target_task("updatebot_cron")
def target_tasks_updatebot_cron(full_task_graph, parameters, graph_config):
"""Select tasks required to run Updatebot's cron job"""
return ["updatebot-cron"]
@_target_task("customv8_update")
def target_tasks_customv8_update(full_task_graph, parameters, graph_config):
"""Select tasks required for building latest d8/v8 version."""
return ["toolchain-linux64-custom-v8"]
@_target_task("file_update")
def target_tasks_file_update(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to perform nightly in-tree file updates"""
def filter(task):
# For now any task in the repo-update kind is ok
return task.kind in ["repo-update"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("l10n_bump")
def target_tasks_l10n_bump(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to perform l10n bumping."""
def filter(task):
# For now any task in the repo-update kind is ok
return task.kind in ["l10n-bump"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("merge_automation")
def target_tasks_merge_automation(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to perform repository merges."""
def filter(task):
# For now any task in the repo-update kind is ok
return task.kind in ["merge-automation"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("scriptworker_canary")
def target_tasks_scriptworker_canary(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to run scriptworker canaries."""
def filter(task):
# For now any task in the repo-update kind is ok
return task.kind in ["scriptworker-canary"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("cron_bouncer_check")
def target_tasks_bouncer_check(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to perform bouncer version verification."""
def filter(task):
if not filter_for_project(task, parameters):
return False
# For now any task in the repo-update kind is ok
return task.kind in ["cron-bouncer-check"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("staging_release_builds")
def target_tasks_staging_release(full_task_graph, parameters, graph_config):
"""
Select all builds that are part of releases.
"""
def filter(task):
if not task.attributes.get("shipping_product"):
return False
if parameters["release_type"].startswith(
"esr"
) and "android" in task.attributes.get("build_platform", ""):
return False
if parameters["release_type"] != "beta" and "devedition" in task.attributes.get(
"build_platform", ""
):
return False
if task.attributes.get("shipping_phase") == "build":
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("release_simulation")
def target_tasks_release_simulation(full_task_graph, parameters, graph_config):
"""
Select builds that would run on push on a release branch.
"""
project_by_release = {
"nightly": "mozilla-central",
"beta": "mozilla-beta",
"release": "mozilla-release",
"esr115": "mozilla-esr115",
}
target_project = project_by_release.get(parameters["release_type"])
if target_project is None:
raise Exception("Unknown or unspecified release type in simulation run.")
def filter_for_target_project(task):
"""Filter tasks by project. Optionally enable nightlies."""
run_on_projects = set(task.attributes.get("run_on_projects", []))
return match_run_on_projects(target_project, run_on_projects)
def filter_out_android_on_esr(task):
if parameters["release_type"].startswith(
"esr"
) and "android" in task.attributes.get("build_platform", ""):
return False
return True
return [
l
for l, t in full_task_graph.tasks.items()
if filter_release_tasks(t, parameters)
and filter_out_cron(t, parameters)
and filter_for_target_project(t)
and filter_out_android_on_esr(t)
]
@_target_task("codereview")
def target_tasks_codereview(full_task_graph, parameters, graph_config):
"""Select all code review tasks needed to produce a report"""
def filter(task):
# Ending tasks
if task.kind in ["code-review"]:
return True
# Analyzer tasks
if task.attributes.get("code-review") is True:
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("nothing")
def target_tasks_nothing(full_task_graph, parameters, graph_config):
"""Select nothing, for DONTBUILD pushes"""
return []
@_target_task("daily_beta_perf")
def target_tasks_daily_beta_perf(full_task_graph, parameters, graph_config):
"""
Select performance tests on the beta branch to be run daily
"""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-daily-beta-perf"
)
if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={
"reason": "to avoid triggering multiple daily beta perftests off of the same revision",
},
):
return []
def filter(task):
platform = task.attributes.get("test_platform")
attributes = task.attributes
try_name = attributes.get("raptor_try_name") or task.label
unittest_suite = attributes.get("unittest_suite")
if unittest_suite not in ("raptor", "awsy", "talos"):
return False
if not platform:
return False
# Select beta tasks for awsy
if "awsy" in try_name:
if accept_awsy_task(try_name, platform):
return True
return False
# Select beta tasks for talos
if "talos" == unittest_suite:
if accept_raptor_desktop_build(platform):
if "windows11-64" in platform:
if "xperf" in try_name:
return True
return False
if ("mac" in platform or "windows" in platform) and "g3" in try_name:
return False
if "-swr" in try_name:
if "dromaeo" in try_name:
return False
if "perf-reftest-singletons" in try_name:
return False
if "realworldweb" in try_name:
return False
if any(
x in try_name
for x in ("prof", "ipc", "gli", "sessionrestore", "tabswitch")
):
return False
return True
return False
if accept_raptor_desktop_build(platform):
if "browsertime" and "firefox" in try_name:
if "profiling" in try_name:
return False
if "bytecode" in try_name:
return False
if "live" in try_name:
return False
if "webext" in try_name:
return False
if "unity" in try_name:
return False
if "wasm" in try_name:
return False
if "tp6-bench" in try_name:
return False
if "tp6" in try_name:
return True
if "benchmark" in try_name:
return True
elif accept_raptor_android_build(platform):
# Select browsertime & geckoview specific tests
if "browsertime" and "geckoview" in try_name:
if "power" in try_name:
return False
if "cpu" in try_name:
return False
if "profiling" in try_name:
return False
if "-live" in try_name:
return False
if "speedometer" in try_name:
return True
if "webgl" in try_name:
return True
if "tp6m" in try_name:
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("weekly_release_perf")
def target_tasks_weekly_release_perf(full_task_graph, parameters, graph_config):
"""
Select performance tests on the release branch to be run weekly
"""
def filter(task):
platform = task.attributes.get("test_platform")
attributes = task.attributes
try_name = attributes.get("raptor_try_name") or task.label
if attributes.get("unittest_suite") not in ("raptor", "awsy"):
return False
if not platform:
return False
# Select release tasks for awsy
if "awsy" in try_name:
if accept_awsy_task(try_name, platform):
return True
return False
# Select browsertime tests
if accept_raptor_desktop_build(platform):
if "browsertime" and "firefox" in try_name:
if "power" in try_name:
return False
if "profiling" in try_name:
return False
if "bytecode" in try_name:
return False
if "live" in try_name:
return False
if "webext" in try_name:
return False
if "tp6-bench" in try_name:
return False
if "tp6" in try_name:
return True
if "benchmark" in try_name:
return True
if "youtube-playback" in try_name:
return True
elif accept_raptor_android_build(platform):
# Select browsertime & geckoview specific tests
if "browsertime" and "geckoview" in try_name:
if "power" in try_name:
return False
if "cpu" in try_name:
return False
if "profiling" in try_name:
return False
if "-live" in try_name:
return False
if "speedometer" in try_name:
return True
if "webgl" in try_name:
return True
if "tp6m" in try_name:
return True
if "youtube-playback" in try_name:
return True
return False
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("raptor_tp6m")
def target_tasks_raptor_tp6m(full_task_graph, parameters, graph_config):
"""
Select tasks required for running raptor cold page-load tests on fenix and refbrow
"""
def filter(task):
platform = task.attributes.get("build_platform")
attributes = task.attributes
if platform and "android" not in platform:
return False
if attributes.get("unittest_suite") != "raptor":
return False
try_name = attributes.get("raptor_try_name")
if "-cold" in try_name and "shippable" in platform:
# Get browsertime amazon smoke tests
if (
"browsertime" in try_name
and "amazon" in try_name
and "search" not in try_name
):
return True
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("backfill_all_browsertime")
def target_tasks_backfill_all_browsertime(full_task_graph, parameters, graph_config):
"""
Search for revisions that contains patches that were reviewed by perftest reviewers
and landed the day before the cron is running. Trigger backfill-all-browsertime action
task on each of them.
"""
from gecko_taskgraph.actions.util import get_decision_task_id, get_pushes
def date_is_yesterday(date):
yesterday = datetime.today() - timedelta(days=1)
date = datetime.fromtimestamp(date)
return date.date() == yesterday.date()
def reviewed_by_perftest(push):
try:
commit_message = get_hg_commit_message(
os.path.join(GECKO, graph_config["product-dir"]), rev=push
)
except Exception as e:
print(e)
return False
for line in commit_message.split("\n\n"):
if line.lower().startswith("bug ") and "r=" in line:
if "perftest-reviewers" in line.split("r=")[-1]:
print(line)
return True
return False
pushes = get_pushes(
project=parameters["head_repository"],
end_id=int(parameters["pushlog_id"]),
depth=200,
full_response=True,
)
for push_id in sorted([int(p) for p in pushes.keys()], reverse=True):
push_rev = pushes[str(push_id)]["changesets"][-1]
push_info = find_hg_revision_push_info(
"https://hg.mozilla.org/integration/" + parameters["project"], push_rev
)
pushdate = int(push_info["pushdate"])
if date_is_yesterday(pushdate) and reviewed_by_perftest(push_rev):
from gecko_taskgraph.actions.util import trigger_action
print(
f"Revision {push_rev} was created yesterday and was reviewed by "
f"#perftest-reviewers."
)
try:
push_decision_task_id = get_decision_task_id(
parameters["project"], push_id
)
except Exception:
print(f"Could not find decision task for push {push_id}")
continue
try:
trigger_action(
action_name="backfill-all-browsertime",
# This lets the action know on which push we want to add a new task
decision_task_id=push_decision_task_id,
)
except Exception as e:
print(f"Failed to trigger action for {push_rev}: {e}")
return []
@_target_task("condprof")
def target_tasks_condprof(full_task_graph, parameters, graph_config):
"""
Select tasks required for building conditioned profiles.
"""
for name, task in full_task_graph.tasks.items():
if task.kind == "condprof":
if "a51" not in name: # bug 1765348
yield name
@_target_task("system_symbols")
def target_tasks_system_symbols(full_task_graph, parameters, graph_config):
"""
Select tasks for scraping and uploading system symbols.
"""
for name, task in full_task_graph.tasks.items():
if task.kind in [
"system-symbols",
"system-symbols-upload",
"system-symbols-reprocess",
]:
yield name
@_target_task("perftest")
def target_tasks_perftest(full_task_graph, parameters, graph_config):
"""
Select perftest tasks we want to run daily
"""
for name, task in full_task_graph.tasks.items():
if task.kind != "perftest":
continue
if task.attributes.get("cron", False):
yield name
@_target_task("perftest-on-autoland")
def target_tasks_perftest_autoland(full_task_graph, parameters, graph_config):
"""
Select perftest tasks we want to run daily
"""
for name, task in full_task_graph.tasks.items():
if task.kind != "perftest":
continue
if task.attributes.get("cron", False) and any(
test_name in name for test_name in ["view"]
):
yield name
@_target_task("l10n-cross-channel")
def target_tasks_l10n_cross_channel(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to run l10n cross-channel."""
def filter(task):
return task.kind in ["l10n-cross-channel"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("eslint-build")
def target_tasks_eslint_build(full_task_graph, parameters, graph_config):
"""Select the task to run additional ESLint rules which require a build."""
for name, task in full_task_graph.tasks.items():
if task.kind != "source-test":
continue
if "eslint-build" in name:
yield name
@_target_task("holly_tasks")
def target_tasks_holly(full_task_graph, parameters, graph_config):
"""Bug 1814661: only run updatebot tasks on holly"""
def filter(task):
return task.kind == "updatebot"
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@_target_task("snap_upstream_tests")
def target_tasks_snap_upstream_tests(full_task_graph, parameters, graph_config):
"""
Select tasks for testing Snap package built as upstream. Omit -try because
it does not really make sense on a m-c cron
"""
for name, task in full_task_graph.tasks.items():
if "snap-upstream-test" in name and not "-try" in name:
yield name
@_target_task("nightly-android")
def target_tasks_nightly_android(full_task_graph, parameters, graph_config):
def filter(task, parameters):
# geckoview
if task.attributes.get("shipping_product") == "fennec" and task.kind in (
"beetmover-geckoview",
"upload-symbols",
):
return True
# fenix/focus/a-c
build_type = task.attributes.get("build-type", "")
return build_type in (
"nightly",
"focus-nightly",
"fenix-nightly",
"fenix-nightly-firebase",
"focus-nightly-firebase",
)
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.branch."
f"{parameters['head_ref']}.revision.{parameters['head_rev']}.taskgraph.decision-nightly-android"
)
if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={
"reason": "to avoid triggering multiple nightlies off the same revision",
},
):
return []
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@_target_task("android-l10n-import")
def target_tasks_android_l10n_import(full_task_graph, parameters, graph_config):
return [l for l, t in full_task_graph.tasks.items() if l == "android-l10n-import"]
@_target_task("android-l10n-sync")
def target_tasks_android_l10n_sync(full_task_graph, parameters, graph_config):
return [l for l, t in full_task_graph.tasks.items() if l == "android-l10n-sync"]
|