Bug 1470886 - only produce tasks for recognized tasks_for r=tomprince

This also updates actions to "see through" the conditional.  Soon we won't be
using kind=task, so this hack will be less important.

MozReview-Commit-ID: Aa6g9ZqoPMa

--HG--
extra : rebase_source : 7434f2047c48ff0d1fa6de9e3419fb4e0bf0bb72
This commit is contained in:
Dustin J. Mitchell 2018-06-25 18:21:03 +00:00
Родитель c8d0f5b377
Коммит af478ed758
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -4,6 +4,8 @@
# - action tasks - taskcluster/taskgraph/actions/registry.py
version: 1
tasks:
$if: 'tasks_for in ["hg-push", "action", "cron"]'
then:
- $let:
# sometimes the push user is just `ffxbld` or the like, but we want an email-like field..
ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
@ -197,3 +199,5 @@ tasks:
then:
cron: {$json: {$eval: 'cron'}}
- tasks_for: '${tasks_for}'
# no tasks for unrecognized tasks_for
else: []

Просмотреть файл

@ -193,7 +193,13 @@ def register_callback_action(name, title, symbol, description, order=10000,
if taskcluster_yml['version'] != 1:
raise Exception(
'actions.json must be updated to work with .taskcluster.yml')
if not isinstance(taskcluster_yml['tasks'], list):
# allow a top-level conditional (bug 1470886)
tasks = taskcluster_yml['tasks']
if isinstance(tasks, dict) and '$if' in tasks:
tasks = tasks['then']
if not isinstance(tasks, list):
raise Exception(
'.taskcluster.yml "tasks" must be a list for action tasks')
@ -206,7 +212,7 @@ def register_callback_action(name, title, symbol, description, order=10000,
'push': push,
'action': action,
},
'in': taskcluster_yml['tasks'][0],
'in': tasks[0],
},
})