Skip to content

Conversation

@ahal
Copy link
Contributor

@ahal ahal commented Jan 14, 2026

@ahal ahal requested a review from a team as a code owner January 14, 2026 20:06
@ahal ahal requested review from lotas, matt-boris and petemoore and removed request for a team January 14, 2026 20:06
@ahal ahal changed the title RFC XXXX - Trigger hooks from Github Service RFC 196 - Trigger hooks from Github Service Jan 14, 2026
@ahal ahal changed the title RFC 196 - Trigger hooks from Github Service RFC 0196 - Trigger hooks from Github Service Jan 14, 2026
@ahal ahal force-pushed the ahal/push-qrznvxmlmytp branch 2 times, most recently from 5ccb5fb to c241428 Compare January 14, 2026 20:51

The `triggerHook` API returns the hook task's `taskId` as part of the response.
Taskcluster Github will use this `taskId` to create a record in the Github
builds table. This will allow Taskcluster Github to add the task to Github's
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For checks and statuses to work properly, github internal queue listener depends on the routing keys - route.checks/route.statuses.
Maybe this should be part of the context passed to the trigger, since .taskcluster.yml knows which type to use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, maybe it could just add reporting to the payload. Maybe also policy? Not sure if that would be useful though..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we just ignore status as isn't it supposedly deprecated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we should make checks default (iirc currently statuses are being used if reporting is not defined)
Would policy be useful for hook payload? I thought github service would still make that decision prior to trigger that hook or not.
But we can surely pass whole .taskcluster.yml source that was used as part of the trigger payload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't immediately think of a reason we'd need policy, so let's forget about that.

I'm equally happy adding reporting to the context, or for our use case, just assuming that everything is using checks (which afaik it is). Wnat me to update the RFC to include reporting?

@lotas
Copy link
Contributor

lotas commented Jan 15, 2026

Thank you @ahal, that's a solid proposal.

As I understand we don't limit the number of hooks we could trigger here, same way as we didn't limit number of tasks created.
And as I understand a possible use case would be to create hooks dedicated to various events that would check the payload and decide which set of tasks needs to be created? (checking github event and action)
If that's the case, I wonder if we could also include filtering on the .taskcluster.yml side to fire some hooks only for specific github events?

But I guess this might not be the desired flow

@ahal
Copy link
Contributor Author

ahal commented Jan 15, 2026

So we need to filter on more than just the Github event type and action. Off the top of my head, we also filter on branch name and repo URL, but there are probably others.

Currently we use the JSON-e in the tasks key to do this filtering. We setup the logic such that an empty list is returned, and then TC Github just does nothing (no errors, no tasks). I think we'd want to do the same here, e.g do the filtering in the hook's JSON-e template.

From the docs:

If the task template renders to null, no task is created.

This gives us more control over where tasks can run.

I'm not opposed to TC Github also providing a way to do some basic filtering, I just don't think it would benefit our specific use case much. Unless it's trivial to do, I'd suggest leaving it out of this RFC to keep things simple. We can always implement later if needed.

@ahal ahal force-pushed the ahal/push-qrznvxmlmytp branch from c241428 to 33c2060 Compare January 15, 2026 15:31
@ahal
Copy link
Contributor Author

ahal commented Jan 15, 2026

Added a blurb to the "Edge Cases" section about what to do if the triggerHook call doesn't create any tasks.

@ahal
Copy link
Contributor Author

ahal commented Jan 15, 2026

I'm not opposed to TC Github also providing a way to do some basic filtering, I just don't think it would benefit our specific use case much. Unless it's trivial to do, I'd suggest leaving it out of this RFC to keep things simple. We can always implement later if needed.

Though thinking about it.. without any GH service side filtering, we would have a lot of triggerHook calls that render null tasks. One per Github check suite event. This isn't necessarily a problem, but it might be nice to reduce load on the hook service and make it easier to browse the hooks page in the UI.

I dunno, I could be persuaded either way.

@lotas
Copy link
Contributor

lotas commented Jan 16, 2026

Though thinking about it.. without any GH service side filtering, we would have a lot of triggerHook calls that render null tasks. One per Github check suite event. This isn't necessarily a problem, but it might be nice to reduce load on the hook service and make it easier to browse the hooks page in the UI.

Right, this might a good reason to not trigger a hook knowing it would be competing with valid tasks in the dedicated worker pools.

I quickly checked logs

jsonPayload.serviceContext.service="github"
jsonPayload.Fields.message=~"compiled with zero tasks"

Gives me ~9k for the last 2 weeks (most of which are web-platform-tests ~5k of those) So maybe in the grand scheme that is not too many tasks

- `event` - the raw Github event object
- `now` - the current time, as a string
- `taskcluster_root_url` - the root URL of the Taskcluster deployment
- `tasks_for` - the Github event type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume these would overwrite any version of them provided in the context? If so, these should probably be forbidden from being in the context in the first place to avoid confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this proposal anything in the context would be in a separate namespace. So in the JSON-e it would be possible to have:

${payload.tasks_for}  # implicit
${payload.context.tasks_for}  # project provided

I agree it would be confusing if a project did this, but given they don't overlap, I don't think we should prevent it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaaah, okay. Yep, makes sense to me!


A new `hooks` key will be added to the [taskcluster-yml-v1] schema. This key is
a list, where each item is an object containing `hookId` and optionally
additional `context`. Hook ID corresponds to an existing hook in the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the word context here, but I couldn't think of anything better.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants