Ensure all tasks started from decision_task.py are on Treeherder.

This commit is contained in:
Simon Sapin 2018-12-13 11:04:17 +01:00
parent 1ec78c065a
commit 4cd200dd61
2 changed files with 32 additions and 11 deletions

View file

@ -5,10 +5,15 @@
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import os.path
from decisionlib import *
import decisionlib
from decisionlib import CONFIG, SHARED
def main(task_for):
assert CONFIG.git_ref.startswith("refs/heads/")
branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_names.append("servo-" + branch)
if task_for == "github-push":
# FIXME https://github.com/servo/servo/issues/22325 implement these:
macos_wpt = magicleap_dev = linux_arm32_dev = linux_arm64_dev = \
@ -56,9 +61,6 @@ def main(task_for):
android_x86_wpt
],
}
assert CONFIG.git_ref.startswith("refs/heads/")
branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_names.append("servo-" + branch)
for function in by_branch_name.get(branch, []):
function()
@ -74,7 +76,7 @@ def mocked_only():
windows_release()
linux_wpt()
android_x86_wpt()
linux_build_task("Indexed by task definition").find_or_create()
decisionlib.DockerWorkerTask("Indexed by task definition").find_or_create()
ping_on_daily_task_failure = "SimonSapin, nox, emilio"
@ -141,7 +143,7 @@ def linux_tidy_unit_docs():
def upload_docs():
docs_build_task_id = Task.find("docs." + CONFIG.git_sha)
docs_build_task_id = decisionlib.Task.find("docs." + CONFIG.git_sha)
return (
linux_task("Upload docs to GitHub Pages")
.with_treeherder("Linux x64", "DocUpload")
@ -187,7 +189,8 @@ def with_rust_nightly():
modified_build_env["RUSTFLAGS"] = " ".join(flags)
return (
linux_build_task("Linux x64: with Rust Nightly", build_env=modified_build_env)
linux_build_task("with Rust Nightly", build_env=modified_build_env)
.with_treeherder("Linux x64", "RustNightly")
.with_script("""
echo "nightly" > rust-toolchain
./mach build --dev
@ -239,7 +242,7 @@ def android_x86_release():
def android_x86_wpt():
build_task = android_x86_release()
return (
DockerWorkerTask("WPT")
linux_task("WPT")
.with_treeherder("Android x86")
.with_provisioner_id("proj-servo")
.with_worker_type("docker-worker-kvm")
@ -402,18 +405,28 @@ def dockerfile_path(name):
def linux_task(name):
return DockerWorkerTask(name).with_worker_type("servo-docker-worker")
return (
decisionlib.DockerWorkerTask(name)
.with_worker_type("servo-docker-worker")
.with_treeherder_required()
)
def windows_task(name):
return WindowsGenericWorkerTask(name).with_worker_type("servo-win2016")
return (
decisionlib.WindowsGenericWorkerTask(name)
.with_worker_type("servo-win2016")
.with_treeherder_required()
)
def macos_task(name):
return (
MacOsGenericWorkerTask(name)
decisionlib.MacOsGenericWorkerTask(name)
.with_provisioner_id("proj-servo")
.with_worker_type("macos")
.with_treeherder_required()
)

View file

@ -119,6 +119,7 @@ class Task:
self.scopes = []
self.routes = []
self.extra = {}
self.treeherder_required = False
# All `with_*` methods return `self`, so multiple method calls can be chained.
with_description = chaining(setattr, "description")
@ -135,6 +136,10 @@ class Task:
with_extra = chaining(update_attr, "extra")
def with_treeherder_required(self):
self.treeherder_required = True
return self
def with_treeherder(self, category, symbol=None):
symbol = symbol or self.name
assert len(symbol) <= 25, symbol
@ -164,6 +169,7 @@ class Task:
"tc-treeherder-staging" + suffix,
)
self.treeherder_required = False # Taken care of
return self
def build_worker_payload(self): # pragma: no cover
@ -183,6 +189,8 @@ class Task:
<https://docs.taskcluster.net/docs/reference/platform/taskcluster-queue/references/api#createTask>
"""
worker_payload = self.build_worker_payload()
assert not self.treeherder_required, \
"make sure to call with_treeherder() for this task: %s" % self.name
assert CONFIG.decision_task_id
assert CONFIG.task_owner