Skip to content

Commit

Permalink
Schedule a scriptWorker task on push of tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Lissy committed Nov 17, 2017
1 parent 1c38190 commit 4d6d659
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 1 deletion.
1 change: 1 addition & 0 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tasks:
scopes: [
"queue:create-task:lowest:{{ taskcluster.docker.provisionerId }}/deepspeech-worker",
"queue:create-task:lowest:deepspeech-provisioner/ds-macos-light",
"queue:create-task:lowest:deepspeech-provisioner/ds-scriptworker",
"queue:route:index.project.deepspeech.*",
"queue:route:notify.irc-channel.*",
"queue:scheduler-id:taskcluster-github",
Expand Down
1 change: 1 addition & 0 deletions taskcluster/.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build:
- "pull_request.synchronize"
- "pull_request.reopened"
- "push"
ref_match: "invalid-refs-should-not-work"
dependencies: []
maxRunTime: 3600
system_setup:
Expand Down
28 changes: 28 additions & 0 deletions taskcluster/scriptworker-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
build:
template_file: simple-task.tyml
dependencies:
# Make sure builds are ready
- "darwin-amd64-cpu-opt"
- "linux-amd64-cpu-opt"
- "linux-rpi3-cpu-opt"
# For those we have tests, ensure they pass.
- "test-python_27-linux-amd64-opt"
- "test-python_34-linux-amd64-opt"
- "test-python_35-linux-amd64-opt"
- "test-python_36-linux-amd64-opt"
- "test-nodejs_4x-linux-amd64-opt"
- "test-nodejs_5x-linux-amd64-opt"
- "test-nodejs_6x-linux-amd64-opt"
allowed:
- "push"
ref_match: "refs/tags/"
routes:
- "notify.irc-channel.${notifications.irc}.on-exception"
- "notify.irc-channel.${notifications.irc}.on-failed"
artifacts_deps:
- "darwin-amd64-cpu-opt"
- "linux-amd64-cpu-opt"
- "linux-rpi3-cpu-opt"
metadata:
name: "DeepSpeech Packages"
description: "Trigger Uploading of DeepSpeech Packages to the Internets"
38 changes: 38 additions & 0 deletions taskcluster/simple-task.tyml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$if: '(event.event in build.allowed) && (build.ref_match in event.head.ref)'
then:
taskId: ${taskcluster.taskId}
provisionerId: ${taskcluster.script.provisionerId}
workerType: ${taskcluster.script.workerType}
taskGroupId: ${taskcluster.taskGroupId}
schedulerId: ${taskcluster.schedulerId}
dependencies:
$map: { $eval: build.dependencies }
each(b):
$eval: as_slugid(b)
created: { $fromNow: '0 sec' }
deadline: { $fromNow: '1 day' }
expires:
$if: 'event.event == "push"'
then: { $fromNow: '6 months' }
else: { $fromNow: '7 days' }

extra:
github:
$if: 'event.event == "push"'
then: { $eval: taskcluster.github_events.merge }
else: { $eval: taskcluster.github_events.pull_request }

routes:
{ $eval: build.routes }

payload:
artifacts_deps:
$map: { $eval: build.artifacts_deps }
each(b):
$eval: as_slugid(b)

metadata:
name: ${build.metadata.name}
description: ${build.metadata.description}
owner: ${event.head.user.email}
source: ${event.head.repo.url}
3 changes: 3 additions & 0 deletions taskcluster/worker.cyml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ taskcluster:
generic:
provisionerId: deepspeech-provisioner
workerType: ds-macos-light
script:
provisionerId: deepspeech-provisioner
workerType: ds-scriptworker
3 changes: 2 additions & 1 deletion tc-schedule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ curl -L --silent https://raw.githubusercontent.com/lissyx/taskcluster-github-dec
# This should help us track merge failures in advance
for event in pull_request.opened pull_request.synchronize pull_request.reopened push;
do
GITHUB_EVENT="${event}" TASK_ID="" python3 ${curdir}/tc-decision.py --dry
GITHUB_EVENT="${event}" TASK_ID="" GITHUB_HEAD_REF="refs/heads/branchName" python3 ${curdir}/tc-decision.py --dry
GITHUB_EVENT="${event}" TASK_ID="" GITHUB_HEAD_REF="refs/tags/tagName" python3 ${curdir}/tc-decision.py --dry
done;

python3 ${curdir}/tc-decision.py

0 comments on commit 4d6d659

Please sign in to comment.