taskcluster/taskcluster-tools

actions.json is not fully validated before trying to trigger actions

Closed this issue · 6 comments

I had an actions.json that was missing the variables field completely. That led to the following error when trying to trigger an action:

Error can't convert undefined to object

which is not really helpful.

Thankfully, the js debugger got me to:
https://github.com/taskcluster/taskcluster-tools/blob/master/src/views/UnifiedInspector/ActionsMenu.jsx#L447

It turns out actions is used without validation of its schema, and variables is required per said schema. A schema validation error would have been more useful.

We already have Ajv in tools, so this shouldn't be much to add.

The schema is in taskcluster-references so could be downloaded with a libUrls reference.

This would fix #547 too.

This would fix #547 too.

Or not, the schema doesn't list context as required.

@djmitche How do you have access to the action schema via libUrls? I tried libUrls.schema('https://tasklcuster.net', 'references', 'action-schema-v1.yml') but I don't think this works.

Hm, it probably doesn't work for https://taskcluster.net! Hm, and it doesn't appear to be on https://taskcluster.imbstack.com/schemas/ either. I suspect this is related to https://bugzilla.mozilla.org/show_bug.cgi?id=1476420.

[edit: typo fixed] OK, http://schemas.taskcluster.net/common/action-schema-v1.json exists now. That's libUrls.schema('https://taskcluster.net', 'common', 'action-schema-v1.yml') (not 'references').

s/tasklcuster/taskcluster/