Skip to content

Support build-signing tasks #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions bot/code_coverage_bot/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,23 @@ def name_to_chunk(name: str):
Helper to convert a task name to a chunk
Used by chunk mapping
"""
# Some tests are run on build machines, we define a placeholder chunk for those.
if name.startswith("build-"):
# Some tests are run on build machines, we define placeholder chunks for those.
if name.startswith("build-signing-"):
return "build-signing"
elif name.startswith("build-"):
return "build"

name = name[name.find("/") + 1 :]
name = name.split("/")[1]

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


def chunk_to_suite(chunk: str):
"""
Helper to convert a chunk to a suite (no numbers)
Used by chunk mapping
"""
return "-".join([p for p in chunk.split("-") if not p.isdigit()])
return "-".join(p for p in chunk.split("-") if not p.isdigit())


def get_chunk(task):
Expand All @@ -145,18 +147,19 @@ def get_suite(task):
assert isinstance(task, dict)
tags = task["tags"]
extra = task["extra"]
treeherder = extra.get("treeherder", {})

if treeherder.get("jobKind") == "build":
if tags.get("kind") == "build":
return "build"
elif tags.get("kind") == "build-signing":
return "build-signing"
elif "suite" in extra:
if isinstance(extra["suite"], dict):
return extra["suite"]["name"]
return extra["suite"]
else:
return tags.get("test-type")

raise Exception("Unknown chunk")
raise Exception(f"Unknown chunk for {task}")


def get_platform(task):
Expand All @@ -166,8 +169,22 @@ def get_platform(task):
assert isinstance(task, dict)
tags = task.get("tags", {})
platform = tags.get("os")

# Fallback on parsing the task name for signing tasks, as they don't have "os" in their tags.
name = task.get("metadata", {}).get("name", "")
if not platform and "signing" in name:
name = name.split("/")[0]
if "linux" in name:
platform = "linux"
if "win" in name:
assert platform is None
platform = "windows"
if "mac" in name:
assert platform is None
platform = "mac"

if not platform:
raise Exception("Unknown platform")
raise Exception(f"Unknown platform for {task}")

# Weird case for android build on Linux docker
if platform == "linux" and tags.get("android-stuff"):
Expand Down
78 changes: 78 additions & 0 deletions bot/tests/fixtures/build-signing-win64-ccov/debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"provisionerId": "scriptworker-k8s",
"workerType": "gecko-t-signing",
"schedulerId": "gecko-level-3",
"taskGroupId": "UhJPTJ9VTCadd4Yga4D5Pw",
"dependencies": [
"G90hAz7wQNG6EJhhnwtSDg"
],
"requires": "all-completed",
"routes": [
"tc-treeherder.v2.mozilla-central.adeaa48edc50404d3c77a2faaf496ac89711b8f6.36996"
],
"priority": "medium",
"retries": 5,
"created": "2020-01-09T03:43:00.310Z",
"deadline": "2020-01-10T03:43:00.310Z",
"expires": "2021-01-08T03:43:00.310Z",
"scopes": [
"project:releng:signing:cert:dep-signing"
],
"payload": {
"maxRunTime": 3600,
"upstreamArtifacts": [
{
"paths": [
"public/build/setup.exe"
],
"formats": [
"autograph_authenticode"
],
"taskId": "G90hAz7wQNG6EJhhnwtSDg",
"taskType": "build"
},
{
"paths": [
"public/build/target.zip"
],
"formats": [
"autograph_authenticode",
"autograph_widevine",
"autograph_omnija"
],
"taskId": "G90hAz7wQNG6EJhhnwtSDg",
"taskType": "build"
}
]
},
"metadata": {
"owner": "[email protected]",
"source": "https://hg.mozilla.org/mozilla-central/file/adeaa48edc50404d3c77a2faaf496ac89711b8f6/taskcluster/ci/build-signing",
"description": "Initial Signing for locale 'en-US' for build 'win64-ccov/debug' ([Treeherder push](https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=adeaa48edc50404d3c77a2faaf496ac89711b8f6))",
"name": "build-signing-win64-ccov/debug"
},
"tags": {
"createdForUser": "[email protected]",
"retrigger": "false",
"kind": "build-signing",
"label": "build-signing-win64-ccov/debug"
},
"extra": {
"index": {
"rank": 0
},
"treeherder": {
"machine": {
"platform": "windows2012-64"
},
"tier": 2,
"symbol": "Bs",
"jobKind": "build",
"collection": {
"ccov": true
}
},
"treeherder-platform": "windows2012-64/ccov",
"parent": "UhJPTJ9VTCadd4Yga4D5Pw"
}
}
5 changes: 5 additions & 0 deletions bot/tests/test_taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def test_get_tasks_in_group(mock_taskcluster, GROUP_TASKS_1, GROUP_TASKS_2):
("test-linux64/debug-mochitest-1", False),
("test-windows10-64/debug-cppunit", False),
("build-win64/debug", False),
("build-signing-win64-ccov/debug", True),
],
)
def test_is_coverage_task(task_name, expected):
Expand All @@ -177,6 +178,7 @@ def test_is_coverage_task(task_name, expected):
("build-linux64-ccov/opt", "build"),
("build-android-test-ccov/opt", "build"),
("build-win64-ccov/debug", "build"),
("build-signing-win64-ccov/debug", "build-signing"),
],
)
def test_name_to_chunk(task_name, expected):
Expand Down Expand Up @@ -214,6 +216,7 @@ def test_chunk_to_suite(chunk, expected):
("build-linux64-ccov/opt", "build"),
("build-android-test-ccov/opt", "build"),
("build-win64-ccov/debug", "build"),
("build-signing-win64-ccov/debug", "build-signing"),
],
)
def test_get_chunk(task_name, expected):
Expand All @@ -238,6 +241,7 @@ def test_get_chunk(task_name, expected):
("build-linux64-ccov/opt", "build"),
("build-android-test-ccov/opt", "build"),
("build-win64-ccov/debug", "build"),
("build-signing-win64-ccov/debug", "build-signing"),
],
)
def test_get_suite(task_name, expected):
Expand All @@ -259,6 +263,7 @@ def test_get_suite(task_name, expected):
("build-linux64-ccov/opt", "linux"),
("build-android-test-ccov/opt", "android"),
("build-win64-ccov/debug", "windows"),
("build-signing-win64-ccov/debug", "windows"),
],
)
def test_get_platform(task_name, expected):
Expand Down
10 changes: 6 additions & 4 deletions report/firefox_code_coverage/codecoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,19 @@ def download_artifact(task_id, artifact, artifacts_path):


def get_chunk(task_name):
# Some tests are run on build machines, we define placeholder chunks for those.
if task_name.startswith("build-signing-"):
return "build-signing"
elif task_name.startswith("build-"):
return "build"

task_name = task_name[task_name.find("/") + 1 :]
return "-".join(
p for p in task_name.split("-") if p not in ("opt", "debug", "e10s", "1proc")
)


def get_suite(task_name):
# Some tests are run on build machines, we define a placeholder chunk for those.
if task_name.startswith("build-"):
return "build"

return "-".join(p for p in get_chunk(task_name).split("-") if not p.isdigit())


Expand Down