-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't error if the webhook event only has GitHub owned labels #1348
Comments
Having look at bit more at this would setting this to I would say that the default of checking the label and erroring doesn't make much sense as a default to me. I would think not erroring makes more sense as a default because the majority of organisations using self-hosted runners will also use GitHub hosted runners I suspect. Only the most security centric organisations will demand all workloads run on self-hosted runners and given GitHub's lack of security features they are unlikely to use the Actions platform to start with or they will be running GHES in which GitHub hosted runners aren't supported. It is a feature on the roadmap github/roadmap#72 but it isn't here today (nor any time soon) and because of the reasons I stated previously I don't see GitHub's Actions offering being popular in that kind of environment any time soon. What was the reason behind the current default config? I can't think of many reasons for wanting to fail the webhook if they don't match as a default. If you did want that you would have some sort of custom monitoring on the webhook and so it doesn't make sense to me to have a default setting based on a hyperthetical monitoring solution. I can see that the list of github managed labels is specific to self-hosted runners and so this probably won't stop my errors right? https://github.com/philips-labs/terraform-aws-github-runner/blob/master/modules/webhook/lambdas/webhook/src/webhook/handler.ts#L116 |
@npalm I'm really keen to hear if this behaviour will be changed or not. If not I'll need to document out cavaets on my end (which will probably not get read 😞 realistically speaking) to help prevent confusion when if other engineers touch the implementation at some point as it won't be clear why the webhooks are "failing". |
@toast-gear put it on my list to check. |
Thanks @npalm excited to replace our existing excessively custom solution with this excellent module! |
First of returning a 403 is certainly not correct. It should be either an error in the 500 range or an OK in the range of 200s. The check is added for a couple of reason
I think the best way forward is to:
|
We certainly don't want to break this! Just prevent a non 2XX response code being returned to GitHub if the labels don't match. |
My apologies but I think I've misunderstood what Perhaps I should describe what I think is the ideal behaviour. The This just seems like the behaviour everyone would want to me? The reason the Now that I've deployed the stacks again with Back to streams of 403 errors then :( https://github.com/philips-labs/terraform-aws-github-runner/blob/develop/modules/webhook/lambdas/webhook/src/webhook/handler.ts#L59-L61 the change is easy enough to do, return 200, change log level, adjust log message slightly to say the job was ignored but I wouldn't know what I'm doing with the tests so wouldn't want to raise the PR. |
I have webhooks setup at the organisation level in my organisation as I don't want to install them at the repo level as that would result in having to manage hundreds of webhooks. When a
workflow_job
event is sent to my API Gateway the webhook is marked as failed as it receives a HTTP 403 response. The errors in my logs are these 2 over and over again:This is confusing as it makes it look like there is a problem with the configuration of the webhook when really the webhook is fine. I know we added support for ignoring known GitHub self-hosted labels in this PR #1244. Given many (probably the majority) of organisations running self-hosted runners will also utilise GitHub's runners too it would be great is we could also make it so when the webhook lambda receives a
workflow_job
event that only containsruns-on
labels for GitHub owned labels such asubuntu-latest
, we ignore them, log the ignore at the debug level (as we do now) and return a HTTP 200 response instead.Fixing this so the webhook still receives a HTTP 200 response marking it as green in the GitHub UI regardless of if the job is bound for a philips-labs runner or not would enable an administrator to more easily see real configuration errors such as a mismatched webhook secret.
EDIT the current GitHub managed labels can be found here https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources, workflow jobs that are marked only for any of these should not result in a non HTTP 200 response (or any other label combination imo)
EDIT As a more concrete example, here are what some of my webhooks look like atm on the organisation webhook screen:
And here are some
Recent Deliveries
in the one of the webhook settings.They are all working fine but it looks like I have a major configuration issue. This leads to lots of confusion unless the adminstrator investigating the webhook errors is:
A) familiar with the GitHub Actions platform
B) familiar with the implementation details of this module
The text was updated successfully, but these errors were encountered: