Skip to content

bot: Build suite, chunk and platform from full task #114

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 5 commits into from
Sep 3, 2019
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
13 changes: 6 additions & 7 deletions bot/code_coverage_bot/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def get(self, platform=None, suite=None, chunk=None):
return filtered_files

def download(self, test_task):
chunk_name = taskcluster.get_chunk(test_task["task"]["metadata"]["name"])
platform_name = taskcluster.get_platform(test_task["task"]["metadata"]["name"])
chunk_name = taskcluster.get_chunk(test_task["task"])
platform_name = taskcluster.get_platform(test_task["task"])
test_task_id = test_task["status"]["taskId"]

for artifact in taskcluster.get_task_artifacts(test_task_id):
Expand Down Expand Up @@ -104,7 +104,8 @@ def download_all(self):
task
for group in groups
for task in taskcluster.get_tasks_in_group(group)
if taskcluster.is_coverage_task(task) and not self.is_filtered_task(task)
if taskcluster.is_coverage_task(task["task"])
and not self.is_filtered_task(task)
]
logger.info("Downloading artifacts from {} tasks".format(len(test_tasks)))

Expand All @@ -130,10 +131,8 @@ def download_all(self):
status
)

chunk_name = taskcluster.get_chunk(test_task["task"]["metadata"]["name"])
platform_name = taskcluster.get_platform(
test_task["task"]["metadata"]["name"]
)
chunk_name = taskcluster.get_chunk(test_task["task"])
platform_name = taskcluster.get_platform(test_task["task"])

if any(to_ignore in chunk_name for to_ignore in SUITES_TO_IGNORE):
continue
Expand Down
6 changes: 4 additions & 2 deletions bot/code_coverage_bot/chunk_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def get_tests_chunks(revision, platform, suite):
run_key_prefix = "test-linux64-ccov"
elif platform == "windows":
run_key_prefix = "test-windows10-64-ccov"
else:
raise Exception("Unsupported platform {}".format(platform))

r = requests.post(
ACTIVEDATA_QUERY_URL,
Expand Down Expand Up @@ -239,7 +241,7 @@ def _inner_generate(
def chunk_test_iter():
test_iter = enumerate(tests_data["result.test"])
return (
(platform, taskcluster.get_chunk(task_names[i]), test)
(platform, taskcluster.name_to_chunk(task_names[i]), test)
for i, test in test_iter
)

Expand All @@ -257,7 +259,7 @@ def chunk_test_iter():
(platform, chunk) = futures[future]
files = future.result()

suite = taskcluster.get_suite(chunk)
suite = taskcluster.chunk_to_suite(chunk)
if is_chunk_only_suite(suite):
per_test_cursor.executemany(
"INSERT INTO file_to_chunk VALUES (?,?,?)",
Expand Down
77 changes: 62 additions & 15 deletions bot/code_coverage_bot/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def perform_download():
"build-android-test-ccov/opt",
]


TEST_PLATFORMS = [
"test-linux64-ccov/debug",
"test-windows10-64-ccov/debug",
Expand All @@ -124,10 +123,16 @@ def perform_download():


def is_coverage_task(task):
return any(task["task"]["metadata"]["name"].startswith(t) for t in TEST_PLATFORMS)
return any(task["metadata"]["name"].startswith(t) for t in TEST_PLATFORMS)


def name_to_chunk(name):
"""
Helper to convert a task name to a chunk
Used by chunk mapping
"""
assert isinstance(name, str)

def get_chunk(name):
# Some tests are run on build machines, we define a placeholder chunk for those.
if name in BUILD_PLATFORMS:
return "build"
Expand All @@ -139,18 +144,60 @@ def get_chunk(name):
return "-".join([p for p in name.split("-") if p != "e10s"])


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


def get_chunk(task):
"""
Build clean chunk name from a Taskcluster task
"""
suite = get_suite(task)
chunks = task["extra"].get("chunks", {})
if "current" in chunks:
return f'{suite}-{chunks["current"]}'
return suite


def get_suite(task):
"""
Build clean suite name from a Taskcluster task
"""
assert isinstance(task, dict)
tags = task["tags"]
extra = task["extra"]
treeherder = extra.get("treeherder", {})

if treeherder.get("jobKind") == "build":
return "build"
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")


def get_platform(name):
if "linux" in name:
return "linux"
elif "win" in name:
return "windows"
elif "android-test" in name:
return "android-test"
elif "android-em" in name:
return "android-emulator"
else:
def get_platform(task):
"""
Build clean platform from a Taskcluster task
"""
assert isinstance(task, dict)
assert isinstance(task, dict)
tags = task.get("tags", {})
platform = tags.get("os")
if not platform:
raise Exception("Unknown platform")

# Weird case for android build on Linux docker
if platform == "linux" and tags.get("android-stuff"):
return "android"

return platform
159 changes: 159 additions & 0 deletions bot/tests/fixtures/build-android-test-ccov/opt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"provisionerId": "aws-provisioner-v1",
"workerType": "gecko-3-b-android",
"schedulerId": "gecko-level-3",
"taskGroupId": "Mu6w3n-dS9GOfrv6wGOtvg",
"dependencies": [
"CGQi0Z1nQhizLPmm9d3wYQ",
"L0gYcGJ1QgeMRebLMme27Q",
"RZMFIeVKTqekWYEP91wu8w",
"SDBWKWVPTC6SI4o4cNXn0w",
"fn4N8jQtRZWbuUAjlqXFLA",
"Mu6w3n-dS9GOfrv6wGOtvg"
],
"requires": "all-completed",
"routes": [
"index.gecko.v2.mozilla-central.latest.mobile.android-test-ccov",
"index.gecko.v2.mozilla-central.pushdate.2019.03.28.20190328173141.mobile.android-test-ccov",
"index.gecko.v2.mozilla-central.pushlog-id.35772.mobile.android-test-ccov",
"index.gecko.v2.mozilla-central.revision.e31357c7759379d2279b6883cb09c91997bfaa5d.mobile.android-test-ccov",
"index.gecko.v2.trunk.revision.e31357c7759379d2279b6883cb09c91997bfaa5d.mobile.android-test-ccov",
"tc-treeherder.v2.mozilla-central.e31357c7759379d2279b6883cb09c91997bfaa5d.35772"
],
"priority": "medium",
"retries": 5,
"created": "2019-03-28T17:38:38.640Z",
"deadline": "2019-03-29T17:38:38.640Z",
"expires": "2020-03-27T17:38:38.640Z",
"scopes": [
"queue:get-artifact:project/gecko/android-sdk/*",
"secrets:get:project/taskcluster/gecko/hgfingerprint",
"docker-worker:relengapi-proxy:tooltool.download.public",
"docker-worker:relengapi-proxy:tooltool.download.internal",
"secrets:get:project/releng/gecko/build/level-3/*",
"docker-worker:cache:gecko-level-3-mozilla-central-build-android-test-ccov-opt-workspace-v3-33ea6ead87f10b63cd64",
"docker-worker:cache:gecko-level-3-checkouts-v3-33ea6ead87f10b63cd64",
"docker-worker:cache:gecko-level-3-tooltool-cache-v3-33ea6ead87f10b63cd64"
],
"payload": {
"onExitStatus": {
"retry": [
4,
72
],
"purgeCaches": [
72
]
},
"maxRunTime": 7200,
"image": {
"path": "public/image.tar.zst",
"type": "task-image",
"taskId": "fn4N8jQtRZWbuUAjlqXFLA"
},
"cache": {
"gecko-level-3-tooltool-cache-v3-33ea6ead87f10b63cd64": "/builds/worker/tooltool-cache",
"gecko-level-3-checkouts-v3-33ea6ead87f10b63cd64": "/builds/worker/checkouts",
"gecko-level-3-mozilla-central-build-android-test-ccov-opt-workspace-v3-33ea6ead87f10b63cd64": "/builds/worker/workspace"
},
"artifacts": {
"public/logs": {
"path": "/builds/worker/logs/",
"expires": "2020-03-27T17:38:38.640Z",
"type": "directory"
},
"public/build": {
"path": "/builds/worker/artifacts/",
"expires": "2020-03-27T17:38:38.640Z",
"type": "directory"
},
"public/code-coverage-grcov.zip": {
"path": "/builds/worker/workspace/build/src/obj-firefox/code-coverage-grcov.zip",
"expires": "2020-03-27T17:38:38.640Z",
"type": "file"
}
},
"command": [
"/builds/worker/bin/run-task",
"--gecko-checkout",
"/builds/worker/workspace/build/src",
"--",
"/builds/worker/workspace/build/src/taskcluster/scripts/builder/build-linux.sh"
],
"env": {
"MOZ_AUTOMATION": "1",
"MOZ_SOURCE_CHANGESET": "e31357c7759379d2279b6883cb09c91997bfaa5d",
"MOZ_FETCHES": "[{\"artifact\": \"public/build/grcov.tar.xz\", \"extract\": true, \"task\": \"CGQi0Z1nQhizLPmm9d3wYQ\"}]",
"PERFHERDER_EXTRA_OPTIONS": "android-test-ccov",
"TOOLTOOL_CACHE": "/builds/worker/tooltool-cache",
"PYTHONUNBUFFERED": "1",
"MOZ_FETCHES_DIR": "/builds/worker/fetches",
"MOZHARNESS_SCRIPT": "mozharness/scripts/fx_desktop_build.py",
"MOZ_BUILD_DATE": "20190328173141",
"MH_BUILD_POOL": "taskcluster",
"HG_STORE_PATH": "/builds/worker/checkouts/hg-store",
"MH_CUSTOM_BUILD_VARIANT_CFG": "android-test-ccov",
"MOZHARNESS_ACTIONS": "get-secrets build",
"GECKO_PATH": "/builds/worker/workspace/build/src",
"GECKO_HEAD_REPOSITORY": "https://hg.mozilla.org/mozilla-central",
"EXTRA_MOZHARNESS_CONFIG": "{\"update_channel\": \"nightly\"}",
"SCCACHE_DISABLE": "1",
"MOZ_TOOLCHAINS": "public/build/android-gradle-dependencies.tar.xz@RZMFIeVKTqekWYEP91wu8w project/gecko/android-sdk/android-sdk-linux.tar.xz@L0gYcGJ1QgeMRebLMme27Q public/build/node.tar.xz@SDBWKWVPTC6SI4o4cNXn0w",
"MOZ_SOURCE_REPO": "https://hg.mozilla.org/mozilla-central",
"GECKO_HEAD_REV": "e31357c7759379d2279b6883cb09c91997bfaa5d",
"MH_BRANCH": "mozilla-central",
"MOZ_SCM_LEVEL": "3",
"GECKO_BASE_REPOSITORY": "https://hg.mozilla.org/mozilla-unified",
"NEED_XVFB": "false",
"MOZ_DISABLE_FULL_SYMBOLS": "1",
"TASKCLUSTER_CACHES": "/builds/worker/checkouts;/builds/worker/tooltool-cache;/builds/worker/workspace",
"GRADLE_USER_HOME": "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline",
"TASKCLUSTER_VOLUMES": "/builds/worker/checkouts;/builds/worker/tooltool-cache;/builds/worker/workspace",
"MOZHARNESS_CONFIG": "builds/releng_base_android_64_builds.py"
},
"features": {
"taskclusterProxy": true,
"relengAPIProxy": true,
"chainOfTrust": true
}
},
"metadata": {
"owner": "[email protected]",
"source": "https://hg.mozilla.org/mozilla-central/file/e31357c7759379d2279b6883cb09c91997bfaa5d/taskcluster/ci/build",
"description": "Android armv7 unit test coverage report ([Treeherder push](https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=e31357c7759379d2279b6883cb09c91997bfaa5d))",
"name": "build-android-test-ccov/opt"
},
"tags": {
"kind": "build",
"worker-implementation": "docker-worker",
"createdForUser": "[email protected]",
"label": "build-android-test-ccov/opt",
"os": "linux",
"android-stuff": "true"
},
"extra": {
"index": {
"rank": 1553794301
},
"chainOfTrust": {
"inputs": {
"docker-image": "fn4N8jQtRZWbuUAjlqXFLA"
}
},
"treeherder": {
"jobKind": "build",
"groupSymbol": "A",
"collection": {
"opt": true
},
"machine": {
"platform": "android-4-0-armv7-api16"
},
"groupName": "Android Gradle tests",
"tier": 1,
"symbol": "test-ccov"
},
"treeherder-platform": "android-4-0-armv7-api16/opt",
"parent": "Mu6w3n-dS9GOfrv6wGOtvg"
}
}
Loading