Closed Bug 1438019 Opened 7 years ago Closed 7 years ago

Allow arbitrary objects in hook.task

Categories

(Taskcluster :: Services, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dustin, Assigned: kritisingh1.ks, Mentored)

References

Details

These are not allowed in the schema right now. While I'm there, the task definition should be generally updated to match queue's task -- priorities, in particular, are out of date.
This bug applies to https://github.com/taskcluster/taskcluster-hooks, and involves modifying the schemas in that repository. Currently, we have a schema for `hook.task` that lists a bunch of fields similar to https://docs.taskcluster.net/reference/platform/taskcluster-queue/docs/task-schema However, Alex has recently changed `hook.task` to be a JSON-e (https://github.com/taskcluster/json-e) template, so it might not look like a task at all! So I think we need to modify the schemas to only require that the `task` property have type `object`. The change should be relatively quick -- the challenge to this bug is figuring out *where* to make the change. https://playingintheworldgame.com/2014/07/19/the-chalk-mark/
Assignee: dustin → nobody
Mentor: dustin
Summary: Allow created/deadline/expires in hook definitions → Allow arbitrary objects in hook.task
Blocks: 1437552
Assignee: nobody → kritisingh1.ks
I think the catch is at https://github.com/taskcluster/taskcluster-hooks/blob/master/schemas/task-status.yml#L50 and https://github.com/taskcluster/taskcluster-hooks/blob/master/schemas/task-status.yml#L51 . Could you hint whether I am thinking is correct or not? I am making a dummy initial PR just for reference for review. Please review that and suggest further changes. Thank you :)
Thanks for the PR! There may be a few schemas to update here. schemas/task-status.yml is the schema for the HTTP response body after a task has been created. Once it's created, a task will always have `created`, `expired`, and `deadline` fields, so I think that schema will not need to change. What is changing is the HTTP request and response bodies that are passing *hooks*. Specifically, the request and responses to createHook and updateHook. Those schemas all say that a hook looks like this: { hookGroupId: .. hookId: .. task: { providionerId: .., workerType: .., schedulerId: .., routes: .., .. } } and the response bodies look similar. This was correct up until a few weeks ago, because the `task` property had to be a valid task definition (https://docs.taskcluster.net/reference/platform/taskcluster-queue/docs/task-schema). However, with Alex's recent work, the `task` property is a JSON-e template, so it can basically contain anything. For example: { task: { $let: { someValue: 10 }, in: { $if: 'someValue < 20' then: ... } } } Basically, the only thing we can say about the `task` property is that it is a JSON object (`type: object`). All of the specific bits about provisionerId, schedulerId, etc. need to be removed.
This is done :) Nice work!
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Component: Hooks → Services
You need to log in before you can comment on or make changes to this bug.