Skip to content

Instantly share code, notes, and snippets.

@jonasfj
Created September 20, 2014 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasfj/d16a2d6edd6dc75f1599 to your computer and use it in GitHub Desktop.
Save jonasfj/d16a2d6edd6dc75f1599 to your computer and use it in GitHub Desktop.
Example task-graph.yml as it might look in-tree... Though we'll probably only have the single decision task there, and then have the decision task make all the other tasks...
# Build task-set as YAML file would look in-tree... this is instatitated by the decision task... if triggered
# Triggers are things that'll trigger the tasks in this file...
trigger:
# How this task is triggered by try-flags:
flags: # Require the following flags
build: # -b, as containing
- debug # d
platform: # AND -p, as containing either
- linux64 # linux64, OR
- all # all
# Example: 'try: -b d -p linux64,win32 -u none -t none' or 'try: -b d -p all -u none -t none'
# This makes me a little sad, as we'll need some parsing of try flags... but at least it'll
# possible to add new options that isn't included under 'all', and it would be possible to create
# "-p desktop" to build desktop platforms just by modifying in-tree configuration. I think that's
# a decent level of flexiblity to give people. We can always invent a new try-flag syntax that we
# can support in addition to what we otherwise have.
# Treeherder to which a commit trigger this task
projects:
- mozilla-central # always triggered for all commits to mozilla-central
- ...
# Name that can be used in dependsOn from other task-sets in-tree to trigger this task-set to be scheduled.
name: 'some-build-task-set'
# task-sets that needs to be triggered whenever this task-set is triggered.
# In fact most test tasks probably lives in a separate task-set and dependsOn the task-sets that contains
# required build-tasks... This way we don't need to replicated the "flags" and "projects" triggers in all task-sets.
# Note: most task-sets probably only contains one task.
dependsOn:
- ... # Identifier trigger.name
tasks:
- taskId: '{{ "build-task" | as-slugid }}'
task:
provisionerId: aws-provisioner
workerType: v2
created: '{{ now }}'
deadline: '{{ "1 day 2 hours" | from-now }}'
payload: {}
metadata:
name: "TaskA: Build something TaskB"
description: |
Description of specific task...
owner: '{{ owner }}'
source: '{{ source }}'
{
"tasks": [
{
"taskId": "apTc63YtR82hWFcvyeKz_w",
"task": {
"provisionerId": "aws-provisioner",
"workerType": "v2",
"created": "2014-09-20T00:01:53.761Z",
"deadline": "2014-09-21T02:01:53.762Z",
"payload": {
"image": "quay.io/mozilla/decider:v3",
"command": [
"/bin/decide"
],
"env": {
"FLAGS": "try: something...",
"REVISION": "REVISION",
"PROJECT": "try"
}
},
"metadata": {
"name": "Make Decision based on flags",
"description": "Description of specific task...\n",
"owner": "user@example.com",
"source": "http://localhost/unit-test"
}
}
},
{
"taskId": "H-4TgomXT0iiAmfVMKXppQ",
"task": {
"provisionerId": "aws-provisioner",
"workerType": "v2",
"created": "2014-09-20T00:01:53.761Z",
"deadline": "2014-09-21T02:01:53.762Z",
"payload": {},
"metadata": {
"name": "TaskA: Build something TaskB",
"description": "Description of specific task...\n",
"owner": "user@example.com",
"source": "http://localhost/unit-test"
}
}
},
{
"taskId": "wc_yKCDgSf-Vnn31bzAdCw",
"requires": [
"H-4TgomXT0iiAmfVMKXppQ"
],
"task": {
"provisionerId": "aws-provisioner",
"workerType": "v2",
"created": "2014-09-20T00:01:53.761Z",
"deadline": "4WuFIn6mTieW-YsmG2MOxA",
"payload": {},
"metadata": {
"name": "TaskA: Build something TaskB",
"description": "Description of specific task...\n",
"owner": "user@example.com",
"source": "http://localhost/unit-test"
}
}
}
],
"metadata": {
"name": "My Test TaskGraph",
"description": "Some description of the test task in **markdown**.\n",
"owner": "user@example.com",
"source": "http://localhost/unit-test"
}
}
tasks:
# A decision task
- taskId: '{{ "decision-task" | as-slugid }}'
task:
provisionerId: aws-provisioner
workerType: v2
created: '{{ now }}'
deadline: '{{ "1 day 2 hours" | from-now }}'
payload:
image: quay.io/mozilla/decider:v3
command:
- /bin/decide
env:
FLAGS: '{{ comment }}'
REVISION: '{{ revision }}'
PROJECT: '{{ project }}'
metadata:
name: "Make Decision based on flags"
description: |
Description of specific task...
owner: '{{ owner }}'
source: '{{ source }}'
# Build task that is independent of the decision task
- taskId: '{{ "build-task" | as-slugid }}'
task:
provisionerId: aws-provisioner
workerType: v2
created: '{{ now }}'
deadline: '{{ "1 day 2 hours" | from-now }}'
payload: {}
metadata:
name: "TaskA: Build something TaskB"
description: |
Description of specific task...
owner: '{{ owner }}'
source: '{{ source }}'
# Test task that depends on build task
- taskId: '{{ "test-task" | as-slugid }}'
requires:
- '{{ "build-task" | as-slugid }}'
task:
provisionerId: aws-provisioner
workerType: v2
created: '{{ now }}'
deadline: '{{ "1 day 2 hours" | as-slugid }}'
payload: {}
metadata:
name: "TaskA: Build something TaskB"
description: |
Description of specific task...
owner: '{{ owner }}'
source: '{{ source }}'
metadata:
name: "My Test TaskGraph"
description: |
Some description of the test task in **markdown**.
owner: '{{ owner }}'
source: '{{ source }}'
@jonasfj
Copy link
Author

jonasfj commented Sep 20, 2014

Note, this might still just be crazy I'm not sure triggers are smart... I just know that we have 3 different reasons that cause a task to be triggered by the decision task:

  1. try flag specifies that we need the task
  2. push is to a branch/treeherder-project (e.g. mozilla-central) for which this test must always run
  3. another task that was triggered requires this task...

Case 3. should ideally be resolved using requires list.... Perhaps we need to substitute in taskIds and auto-trigger if the taskId is required by another task that is somehow triggered...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment