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:
|
||||
- $if: 'tasks_for == "github-push"'
|
||||
then:
|
||||
taskGroupId: {$eval: as_slugid("decision_task")}
|
||||
taskId: {$eval: as_slugid("decision_task")}
|
||||
provisionerId: aws-provisioner-v1
|
||||
workerType: github-worker
|
||||
created: {$fromNow: ''}
|
||||
deadline: {$fromNow: '1 hour'}
|
||||
metadata:
|
||||
name: "Taskcluster experiments for Servo"
|
||||
description: "Initial task"
|
||||
name: "Taskcluster experiments for Servo: Decision task"
|
||||
description: ""
|
||||
owner: ${event.pusher.name}@users.noreply.github.com
|
||||
source: ${event.compare}
|
||||
|
||||
|
@ -20,12 +22,19 @@ tasks:
|
|||
image: "buildpack-deps:bionic-scm"
|
||||
features:
|
||||
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:
|
||||
- /bin/bash
|
||||
- '--login'
|
||||
- '-c'
|
||||
- >-
|
||||
git clone ${event.repository.clone_url} repo &&
|
||||
git clone $DECISION_TASK_CLONE_URL repo &&
|
||||
cd repo &&
|
||||
git checkout ${event.after} &&
|
||||
python2.7 task.py
|
||||
git checkout $DECISION_TASK_COMMIT_SHA &&
|
||||
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