Skip to content

Commit 06115cf

Browse files
authored
Support build-signing tasks (#370)
* bot: Support build-signing tasks * report: Support build-signing tasks * bot: Don't create a list just for join
1 parent df79958 commit 06115cf

File tree

4 files changed

+115
-13
lines changed

4 files changed

+115
-13
lines changed

bot/code_coverage_bot/taskcluster.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,23 @@ def name_to_chunk(name: str):
110110
Helper to convert a task name to a chunk
111111
Used by chunk mapping
112112
"""
113-
# Some tests are run on build machines, we define a placeholder chunk for those.
114-
if name.startswith("build-"):
113+
# Some tests are run on build machines, we define placeholder chunks for those.
114+
if name.startswith("build-signing-"):
115+
return "build-signing"
116+
elif name.startswith("build-"):
115117
return "build"
116118

117-
name = name[name.find("/") + 1 :]
119+
name = name.split("/")[1]
118120

119-
return "-".join([p for p in name.split("-") if p not in NAME_PARTS_TO_SKIP])
121+
return "-".join(p for p in name.split("-") if p not in NAME_PARTS_TO_SKIP)
120122

121123

122124
def chunk_to_suite(chunk: str):
123125
"""
124126
Helper to convert a chunk to a suite (no numbers)
125127
Used by chunk mapping
126128
"""
127-
return "-".join([p for p in chunk.split("-") if not p.isdigit()])
129+
return "-".join(p for p in chunk.split("-") if not p.isdigit())
128130

129131

130132
def get_chunk(task):
@@ -145,18 +147,19 @@ def get_suite(task):
145147
assert isinstance(task, dict)
146148
tags = task["tags"]
147149
extra = task["extra"]
148-
treeherder = extra.get("treeherder", {})
149150

150-
if treeherder.get("jobKind") == "build":
151+
if tags.get("kind") == "build":
151152
return "build"
153+
elif tags.get("kind") == "build-signing":
154+
return "build-signing"
152155
elif "suite" in extra:
153156
if isinstance(extra["suite"], dict):
154157
return extra["suite"]["name"]
155158
return extra["suite"]
156159
else:
157160
return tags.get("test-type")
158161

159-
raise Exception("Unknown chunk")
162+
raise Exception(f"Unknown chunk for {task}")
160163

161164

162165
def get_platform(task):
@@ -166,8 +169,22 @@ def get_platform(task):
166169
assert isinstance(task, dict)
167170
tags = task.get("tags", {})
168171
platform = tags.get("os")
172+
173+
# Fallback on parsing the task name for signing tasks, as they don't have "os" in their tags.
174+
name = task.get("metadata", {}).get("name", "")
175+
if not platform and "signing" in name:
176+
name = name.split("/")[0]
177+
if "linux" in name:
178+
platform = "linux"
179+
if "win" in name:
180+
assert platform is None
181+
platform = "windows"
182+
if "mac" in name:
183+
assert platform is None
184+
platform = "mac"
185+
169186
if not platform:
170-
raise Exception("Unknown platform")
187+
raise Exception(f"Unknown platform for {task}")
171188

172189
# Weird case for android build on Linux docker
173190
if platform == "linux" and tags.get("android-stuff"):
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"provisionerId": "scriptworker-k8s",
3+
"workerType": "gecko-t-signing",
4+
"schedulerId": "gecko-level-3",
5+
"taskGroupId": "UhJPTJ9VTCadd4Yga4D5Pw",
6+
"dependencies": [
7+
"G90hAz7wQNG6EJhhnwtSDg"
8+
],
9+
"requires": "all-completed",
10+
"routes": [
11+
"tc-treeherder.v2.mozilla-central.adeaa48edc50404d3c77a2faaf496ac89711b8f6.36996"
12+
],
13+
"priority": "medium",
14+
"retries": 5,
15+
"created": "2020-01-09T03:43:00.310Z",
16+
"deadline": "2020-01-10T03:43:00.310Z",
17+
"expires": "2021-01-08T03:43:00.310Z",
18+
"scopes": [
19+
"project:releng:signing:cert:dep-signing"
20+
],
21+
"payload": {
22+
"maxRunTime": 3600,
23+
"upstreamArtifacts": [
24+
{
25+
"paths": [
26+
"public/build/setup.exe"
27+
],
28+
"formats": [
29+
"autograph_authenticode"
30+
],
31+
"taskId": "G90hAz7wQNG6EJhhnwtSDg",
32+
"taskType": "build"
33+
},
34+
{
35+
"paths": [
36+
"public/build/target.zip"
37+
],
38+
"formats": [
39+
"autograph_authenticode",
40+
"autograph_widevine",
41+
"autograph_omnija"
42+
],
43+
"taskId": "G90hAz7wQNG6EJhhnwtSDg",
44+
"taskType": "build"
45+
}
46+
]
47+
},
48+
"metadata": {
49+
"owner": "[email protected]",
50+
"source": "https://hg.mozilla.org/mozilla-central/file/adeaa48edc50404d3c77a2faaf496ac89711b8f6/taskcluster/ci/build-signing",
51+
"description": "Initial Signing for locale 'en-US' for build 'win64-ccov/debug' ([Treeherder push](https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=adeaa48edc50404d3c77a2faaf496ac89711b8f6))",
52+
"name": "build-signing-win64-ccov/debug"
53+
},
54+
"tags": {
55+
"createdForUser": "[email protected]",
56+
"retrigger": "false",
57+
"kind": "build-signing",
58+
"label": "build-signing-win64-ccov/debug"
59+
},
60+
"extra": {
61+
"index": {
62+
"rank": 0
63+
},
64+
"treeherder": {
65+
"machine": {
66+
"platform": "windows2012-64"
67+
},
68+
"tier": 2,
69+
"symbol": "Bs",
70+
"jobKind": "build",
71+
"collection": {
72+
"ccov": true
73+
}
74+
},
75+
"treeherder-platform": "windows2012-64/ccov",
76+
"parent": "UhJPTJ9VTCadd4Yga4D5Pw"
77+
}
78+
}

bot/tests/test_taskcluster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def test_get_tasks_in_group(mock_taskcluster, GROUP_TASKS_1, GROUP_TASKS_2):
153153
("test-linux64/debug-mochitest-1", False),
154154
("test-windows10-64/debug-cppunit", False),
155155
("build-win64/debug", False),
156+
("build-signing-win64-ccov/debug", True),
156157
],
157158
)
158159
def test_is_coverage_task(task_name, expected):
@@ -177,6 +178,7 @@ def test_is_coverage_task(task_name, expected):
177178
("build-linux64-ccov/opt", "build"),
178179
("build-android-test-ccov/opt", "build"),
179180
("build-win64-ccov/debug", "build"),
181+
("build-signing-win64-ccov/debug", "build-signing"),
180182
],
181183
)
182184
def test_name_to_chunk(task_name, expected):
@@ -214,6 +216,7 @@ def test_chunk_to_suite(chunk, expected):
214216
("build-linux64-ccov/opt", "build"),
215217
("build-android-test-ccov/opt", "build"),
216218
("build-win64-ccov/debug", "build"),
219+
("build-signing-win64-ccov/debug", "build-signing"),
217220
],
218221
)
219222
def test_get_chunk(task_name, expected):
@@ -238,6 +241,7 @@ def test_get_chunk(task_name, expected):
238241
("build-linux64-ccov/opt", "build"),
239242
("build-android-test-ccov/opt", "build"),
240243
("build-win64-ccov/debug", "build"),
244+
("build-signing-win64-ccov/debug", "build-signing"),
241245
],
242246
)
243247
def test_get_suite(task_name, expected):
@@ -259,6 +263,7 @@ def test_get_suite(task_name, expected):
259263
("build-linux64-ccov/opt", "linux"),
260264
("build-android-test-ccov/opt", "android"),
261265
("build-win64-ccov/debug", "windows"),
266+
("build-signing-win64-ccov/debug", "windows"),
262267
],
263268
)
264269
def test_get_platform(task_name, expected):

report/firefox_code_coverage/codecoverage.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,19 @@ def download_artifact(task_id, artifact, artifacts_path):
113113

114114

115115
def get_chunk(task_name):
116+
# Some tests are run on build machines, we define placeholder chunks for those.
117+
if task_name.startswith("build-signing-"):
118+
return "build-signing"
119+
elif task_name.startswith("build-"):
120+
return "build"
121+
116122
task_name = task_name[task_name.find("/") + 1 :]
117123
return "-".join(
118124
p for p in task_name.split("-") if p not in ("opt", "debug", "e10s", "1proc")
119125
)
120126

121127

122128
def get_suite(task_name):
123-
# Some tests are run on build machines, we define a placeholder chunk for those.
124-
if task_name.startswith("build-"):
125-
return "build"
126-
127129
return "-".join(p for p in get_chunk(task_name).split("-") if not p.isdigit())
128130

129131

0 commit comments

Comments
 (0)