Auto merge of #24652 - servo:nitouryuu, r=nox

Don’t run tasks on new TC for GitHub push events (for now)
This commit is contained in:
bors-servo 2019-11-05 01:54:24 -05:00 committed by GitHub
commit 2aca5c82e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 14 deletions

View file

@ -8,7 +8,10 @@ policy:
tasks:
$let:
task_common:
provisionerId: aws-provisioner-v1
provisionerId:
$if: "taskcluster_root_url == 'https://taskcluster.net'"
then: aws-provisioner-v1
else: proj-servo
created: {$fromNow: ''}
deadline: {$fromNow: '1 day'}
extra:
@ -44,7 +47,18 @@ tasks:
$if: "event.ref[:11] == 'refs/heads/'"
then: "${event.ref[11:]}"
in:
$if: "branch in ['auto', 'try', 'master'] || branch[:4] == 'try-'"
$if: >-
(
taskcluster_root_url == 'https://community-tc.services.mozilla.com' &&
branch == 'try-communitytc'
) || (
taskcluster_root_url == 'https://taskcluster.net' &&
branch != 'try-communitytc' &&
(
branch in ['auto', 'try', 'master'] ||
branch[:4] == 'try-'
)
)
then:
$mergeDeep:
- {$eval: "task_common"}
@ -53,7 +67,10 @@ tasks:
description: ""
owner: ${event.pusher.name}@users.noreply.github.com
source: ${event.compare}
workerType: servo-docker-worker
workerType:
$if: "taskcluster_root_url == 'https://taskcluster.net'"
then: servo-docker-worker
else: docker
scopes:
- "assume:repo:github.com/servo/servo:branch:${branch}"
routes:
@ -82,7 +99,10 @@ tasks:
description: ""
owner: ${event.sender.login}@users.noreply.github.com
source: ${event.pull_request.url}
workerType: servo-docker-untrusted
workerType:
$if: "taskcluster_root_url == 'https://taskcluster.net'"
then: servo-docker-untrusted
else: docker-untrusted
scopes:
- "assume:repo:github.com/servo/servo:pull-request"
routes:

View file

@ -157,7 +157,9 @@ windows_sparse_checkout = [
def linux_tidy_unit_untrusted():
return (
decisionlib.DockerWorkerTask("Tidy + dev build + unit tests")
.with_worker_type("servo-docker-untrusted")
.with_worker_type(
"servo-docker-untrusted" if CONFIG.legacy_tc_deployment else "docker-untrusted"
)
.with_treeherder("Linux x64", "Tidy+Unit")
.with_max_run_time_minutes(60)
.with_dockerfile(dockerfile_path("build"))
@ -732,7 +734,7 @@ def dockerfile_path(name):
def linux_task(name):
return (
decisionlib.DockerWorkerTask(name)
.with_worker_type("servo-docker-worker")
.with_worker_type("servo-docker-worker" if CONFIG.legacy_tc_deployment else "docker")
.with_treeherder_required()
)
@ -740,7 +742,7 @@ def linux_task(name):
def windows_task(name):
return (
decisionlib.WindowsGenericWorkerTask(name)
.with_worker_type("servo-win2016")
.with_worker_type("servo-win2016" if CONFIG.legacy_tc_deployment else "win2016")
.with_treeherder_required()
)
@ -971,10 +973,15 @@ def magicleap_nightly():
CONFIG.task_name_template = "Servo: %s"
CONFIG.index_prefix = "project.servo.servo"
CONFIG.docker_image_build_worker_type = "servo-docker-worker"
CONFIG.docker_images_expire_in = build_dependencies_artifacts_expire_in
CONFIG.repacked_msi_files_expire_in = build_dependencies_artifacts_expire_in
if CONFIG.legacy_tc_deployment:
CONFIG.index_prefix = "project.servo.servo"
CONFIG.docker_image_build_worker_type = "servo-docker-worker"
else: # pragma: no cover
CONFIG.index_prefix = "project.servo"
CONFIG.default_provisioner_id = "proj-servo"
CONFIG.docker_image_build_worker_type = "docker"
if __name__ == "__main__": # pragma: no cover

View file

@ -57,6 +57,15 @@ class Config:
self.git_ref = os.environ.get("GIT_REF")
self.git_sha = os.environ.get("GIT_SHA")
root_url = os.environ.get("TASKCLUSTER_ROOT_URL")
self.legacy_tc_deployment = root_url == "https://taskcluster.net"
if self.legacy_tc_deployment:
self.default_provisioner_id = "aws-provisioner-v1"
else: # pragma: no cover
self.default_provisioner_id = "proj-example"
def task_id(self):
if hasattr(self, "_task_id"):
return self._task_id
@ -131,7 +140,7 @@ class Task:
self.name = name
self.description = ""
self.scheduler_id = "taskcluster-github"
self.provisioner_id = "aws-provisioner-v1"
self.provisioner_id = CONFIG.default_provisioner_id
self.worker_type = "github-worker"
self.deadline_in = "1 day"
self.expires_in = "1 year"
@ -755,24 +764,24 @@ class DockerWorkerTask(UnixTaskMixin, Task):
.with_index_and_artifacts_expire_in(CONFIG.docker_images_expire_in)
.with_features("dind")
.with_env(DOCKERFILE=dockerfile_contents)
.with_artifacts("/image.tar.lz4")
.with_artifacts("/image.tar")
.with_script("""
echo "$DOCKERFILE" | docker build -t taskcluster-built -
docker save taskcluster-built | lz4 > /image.tar.lz4
docker save taskcluster-built > /image.tar
""")
.with_docker_image(
# https://github.com/servo/taskcluster-bootstrap-docker-images#image-builder
"servobrowser/taskcluster-bootstrap:image-builder@sha256:" \
"0a7d012ce444d62ffb9e7f06f0c52fedc24b68c2060711b313263367f7272d9d"
)
.find_or_create("docker-image." + digest)
.find_or_create("docker-image-uncompressed." + digest)
)
return self \
.with_dependencies(image_build_task) \
.with_docker_image({
"type": "task-image",
"path": "public/image.tar.lz4",
"path": "public/image.tar",
"taskId": image_build_task,
})

View file

@ -44,6 +44,7 @@ sys.modules["taskcluster"] = sys.modules[__name__]
sys.dont_write_bytecode = True
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})
os.environ["GIT_REF"] = "refs/heads/auto"
os.environ["TASKCLUSTER_ROOT_URL"] = "https://taskcluster.net"
import decision_task
print("\n# Push:")