diff --git a/.taskcluster.yml b/.taskcluster.yml index f7ec151f292..c43a61e7fbe 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -26,10 +26,7 @@ tasks: taskclusterProxy: true env: DECISION_TASK_ID: {$eval: as_slugid("decision_task")} - DECISION_TASK_OWNER: ${event.pusher.name}@users.noreply.github.com - DECISION_TASK_SOURCE: ${event.compare} - DECISION_TASK_CLONE_URL: ${event.repository.clone_url} - DECISION_TASK_COMMIT_SHA: ${event.after} + GITHUB_EVENT: {$json: event} command: - /bin/bash - '--login' diff --git a/decision-task.py b/decision-task.py index 9bc12df259a..dae912b1d67 100644 --- a/decision-task.py +++ b/decision-task.py @@ -1,9 +1,15 @@ # coding: utf8 import os -import datetime +import json +import pprint import taskcluster +event = json.loads(environ["GITHUB_EVENT"]) +print("GitHub event:") +pprint.pprint(event) +print("") + task_id = taskcluster.slugId() payload = { "taskGroupId": os.environ["DECISION_TASK_ID"], @@ -16,8 +22,8 @@ payload = { "metadata": { "name": "Taskcluster experiments for Servo: Child task", "description": "", - "owner": os.environ["DECISION_TASK_OWNER"], - "source": os.environ["DECISION_TASK_SOURCE"], + "owner": event["pusher"]["name"] + "@users.noreply.github.com", + "source": event["compare"], }, "payload": { "maxRunTime": 600, @@ -27,11 +33,11 @@ payload = { "--login", "-c", """ - git clone %(DECISION_TASK_CLONE_URL)s repo && + git clone {event[repository][clone_url]} repo && cd repo && - git checkout %(DECISION_TASK_COMMIT_SHA)s && + git checkout {event[after]} && ./child-task.sh - """ % os.environ, + """.format(event=event), ], "artifacts": { "public/executable.gz": { @@ -44,5 +50,5 @@ payload = { } # https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"}) -result = queue.createTask(task_id, payload) -print("task %s created…? %r" % (task_id, result)) +queue.createTask(task_id, payload) +print("new task scheduled: " % task_id)