mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
parent
3d7f852fa3
commit
bcea20ff8f
2 changed files with 19 additions and 16 deletions
|
@ -28,13 +28,16 @@ tasks:
|
||||||
taskclusterProxy: true
|
taskclusterProxy: true
|
||||||
env:
|
env:
|
||||||
DECISION_TASK_ID: {$eval: as_slugid("decision_task")}
|
DECISION_TASK_ID: {$eval: as_slugid("decision_task")}
|
||||||
GITHUB_EVENT: {$json: {$eval: event}}
|
GITHUB_EVENT_OWNER: ${event.pusher.name}@users.noreply.github.com
|
||||||
|
GITHUB_EVENT_SOURCE: ${event.compare}
|
||||||
|
GITHUB_EVENT_CLONE_URL: ${event.repository.clone_url}
|
||||||
|
GITHUB_EVENT_COMMIT_SHA: ${event.after}
|
||||||
command:
|
command:
|
||||||
- /bin/bash
|
- /bin/bash
|
||||||
- '--login'
|
- '--login'
|
||||||
- '-c'
|
- '-c'
|
||||||
- >-
|
- >-
|
||||||
git clone ${event.repository.clone_url} repo &&
|
git clone $GITHUB_EVENT_CLONE_URL repo &&
|
||||||
cd repo &&
|
cd repo &&
|
||||||
git checkout ${event.after} &&
|
git checkout $GITHUB_EVENT_COMMIT_SHA &&
|
||||||
python2.7 decision-task/run.py
|
python2.7 decision-task/run.py
|
||||||
|
|
|
@ -6,21 +6,17 @@ import sys
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "vendored"))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "vendored"))
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import taskcluster
|
import taskcluster
|
||||||
|
|
||||||
event = json.loads(os.environ["GITHUB_EVENT"])
|
|
||||||
print("GitHub event:\n%s\n" % json.dumps(event, sort_keys=True, indent=4, separators=(',', ': ')))
|
|
||||||
|
|
||||||
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
|
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
|
||||||
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
|
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
|
||||||
|
|
||||||
command_prefix = """
|
|
||||||
git clone {event[repository][clone_url]} repo &&
|
|
||||||
cd repo &&
|
|
||||||
git checkout {event[after]} &&
|
|
||||||
""".format(event=event)
|
|
||||||
|
|
||||||
def create_task(name, command, artifacts=None, dependencies=None, env=None, cache=None, scopes=None):
|
def create_task(name, command, artifacts=None, dependencies=None, env=None, cache=None, scopes=None):
|
||||||
|
env = env or {}
|
||||||
|
for k in ["GITHUB_EVENT_CLONE_URL", "GITHUB_EVENT_COMMIT_SHA"]:
|
||||||
|
env.setdefault(k, os.environ[k])
|
||||||
|
|
||||||
task_id = taskcluster.slugId()
|
task_id = taskcluster.slugId()
|
||||||
payload = {
|
payload = {
|
||||||
"taskGroupId": os.environ["DECISION_TASK_ID"],
|
"taskGroupId": os.environ["DECISION_TASK_ID"],
|
||||||
|
@ -33,8 +29,8 @@ def create_task(name, command, artifacts=None, dependencies=None, env=None, cach
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "Taskcluster experiments for Servo: " + name,
|
"name": "Taskcluster experiments for Servo: " + name,
|
||||||
"description": "",
|
"description": "",
|
||||||
"owner": event["pusher"]["name"] + "@users.noreply.github.com",
|
"owner": os.environ["GITHUB_EVENT_OWNER"],
|
||||||
"source": event["compare"],
|
"source": os.environ["GITHUB_EVENT_SOURCE"],
|
||||||
},
|
},
|
||||||
"scopes": scopes or [],
|
"scopes": scopes or [],
|
||||||
"payload": {
|
"payload": {
|
||||||
|
@ -45,9 +41,13 @@ def create_task(name, command, artifacts=None, dependencies=None, env=None, cach
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"--login",
|
"--login",
|
||||||
"-c",
|
"-c",
|
||||||
command_prefix + command
|
"""
|
||||||
|
git clone $GITHUB_EVENT_CLONE_URL repo &&
|
||||||
|
cd repo &&
|
||||||
|
git checkout $GITHUB_EVENT_COMMIT_SHA &&
|
||||||
|
""" + command
|
||||||
],
|
],
|
||||||
"env": env or {},
|
"env": env,
|
||||||
"artifacts": {
|
"artifacts": {
|
||||||
"public/" + artifact_name: {
|
"public/" + artifact_name: {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue