Skip to content

Commit

Permalink
Support both Taskcluster deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Nov 4, 2019
1 parent 5abb013 commit d8b6307
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
15 changes: 12 additions & 3 deletions .taskcluster.yml
Expand Up @@ -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:
Expand Down Expand Up @@ -53,7 +56,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:
Expand Down Expand Up @@ -82,7 +88,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:
Expand Down
17 changes: 12 additions & 5 deletions etc/taskcluster/decision_task.py
Expand Up @@ -157,7 +157,9 @@ def mocked_only():
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"))
Expand Down Expand Up @@ -731,15 +733,15 @@ 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()
)


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()
)

Expand Down Expand Up @@ -968,10 +970,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
Expand Down
11 changes: 10 additions & 1 deletion etc/taskcluster/decisionlib.py
Expand Up @@ -57,6 +57,15 @@ def __init__(self):
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
Expand Down Expand Up @@ -131,7 +140,7 @@ def __init__(self, name):
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"
Expand Down
1 change: 1 addition & 0 deletions etc/taskcluster/mock.py
Expand Up @@ -44,6 +44,7 @@ def findTask(self, path):
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:")
Expand Down

0 comments on commit d8b6307

Please sign in to comment.