mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Decision task!
This commit is contained in:
parent
f559fcb5dc
commit
3d12b33e2d
4 changed files with 47 additions and 6 deletions
|
@ -5,13 +5,15 @@ policy:
|
||||||
tasks:
|
tasks:
|
||||||
- $if: 'tasks_for == "github-push"'
|
- $if: 'tasks_for == "github-push"'
|
||||||
then:
|
then:
|
||||||
|
taskGroupId: {$eval: as_slugid("decision_task")}
|
||||||
|
taskId: {$eval: as_slugid("decision_task")}
|
||||||
provisionerId: aws-provisioner-v1
|
provisionerId: aws-provisioner-v1
|
||||||
workerType: github-worker
|
workerType: github-worker
|
||||||
created: {$fromNow: ''}
|
created: {$fromNow: ''}
|
||||||
deadline: {$fromNow: '1 hour'}
|
deadline: {$fromNow: '1 hour'}
|
||||||
metadata:
|
metadata:
|
||||||
name: "Taskcluster experiments for Servo"
|
name: "Taskcluster experiments for Servo: Decision task"
|
||||||
description: "Initial task"
|
description: ""
|
||||||
owner: ${event.pusher.name}@users.noreply.github.com
|
owner: ${event.pusher.name}@users.noreply.github.com
|
||||||
source: ${event.compare}
|
source: ${event.compare}
|
||||||
|
|
||||||
|
@ -20,12 +22,19 @@ tasks:
|
||||||
image: "buildpack-deps:bionic-scm"
|
image: "buildpack-deps:bionic-scm"
|
||||||
features:
|
features:
|
||||||
taskclusterProxy: true
|
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}
|
||||||
command:
|
command:
|
||||||
- /bin/bash
|
- /bin/bash
|
||||||
- '--login'
|
- '--login'
|
||||||
- '-c'
|
- '-c'
|
||||||
- >-
|
- >-
|
||||||
git clone ${event.repository.clone_url} repo &&
|
git clone $DECISION_TASK_CLONE_URL repo &&
|
||||||
cd repo &&
|
cd repo &&
|
||||||
git checkout ${event.after} &&
|
git checkout $DECISION_TASK_COMMIT_SHA &&
|
||||||
python2.7 task.py
|
pip install taskcluster &&
|
||||||
|
python2.7 decision-task.py
|
||||||
|
|
1
child-task.py
Normal file
1
child-task.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
print("hello from a child task!")
|
32
decision-task.py
Normal file
32
decision-task.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import os
|
||||||
|
import datetime
|
||||||
|
import taskcluster
|
||||||
|
|
||||||
|
task_id = os.environ["DECISION_TASK_ID"] + "-child-task"
|
||||||
|
payload = {
|
||||||
|
"taskGroupId": os.environ["DECISION_TASK_ID"],
|
||||||
|
"provisionerId": "aws-provisioner-v1",
|
||||||
|
"workerType": "github-worker",
|
||||||
|
"created": taskcluster.fromNowJSON(""),
|
||||||
|
"deadline": taskcluster.fromNowJSON("1 hour"),
|
||||||
|
"metadata": {
|
||||||
|
"name": "Taskcluster experiments for Servo: Child task",
|
||||||
|
"description": "",
|
||||||
|
"owner": os.environ["DECISION_TASK_OWNER"],
|
||||||
|
"source": os.environ["DECISION_TASK_SOURCE"],
|
||||||
|
}
|
||||||
|
"payload": {
|
||||||
|
"maxRunTime": 600,
|
||||||
|
"image": "buildpack-deps:bionic-scm",
|
||||||
|
"command": [
|
||||||
|
"/bin/bash", "--login", "-c", """
|
||||||
|
git clone %(DECISION_TASK_CLONE_URL)s repo &&
|
||||||
|
cd repo &&
|
||||||
|
git checkout %(DECISION_TASK_COMMIT_SHA)s &&
|
||||||
|
python2.7 child-task.py
|
||||||
|
""" % os.environ
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = taskcluster.Queue().createTask(task_id, payload)
|
||||||
|
print("task created…? %r" % result)
|
1
task.py
1
task.py
|
@ -1 +0,0 @@
|
||||||
print("Hello, World!")
|
|
Loading…
Add table
Add a link
Reference in a new issue