CloudSnorkel / cdk-github-runners

CDK constructs for self-hosted GitHub Actions runners
https://constructs.dev/packages/@cloudsnorkel/cdk-github-runners/
Apache License 2.0
321 stars 37 forks source link

Using an existing Github App #581

Closed OpenSourceable closed 5 months ago

OpenSourceable commented 5 months ago

Hi, Can an existing Github app be used for authentication instead of requiring a new app each time for different runners? Github imposes a limit of 20 apps per organization, and we have already reached it. We want to provision several types of runners, i.e., AMD64/EC2, ARM64/EC2, and Fargate-based. However, it appears as if each runner-type stack requires its webhook and its keys.

Is it possible to re-use an existing Github App for multiple runners? Are there any workarounds or patterns that I might be missing?

Thanks for the great project and your assistance!

kichik commented 5 months ago

You can reuse the same app as long as it has a webhook per instance of GitHubRunners. But it should be much simpler to define all providers with the same GitHubRunners instance.

OpenSourceable commented 5 months ago

You can reuse the same app as long as it has a webhook per instance of GitHubRunners

I'm not sure if I understood your comment 100%, but I don't know if that's possible with GithubApps. As far as I can tell, Github apps can only have one webhook URL per App.

But it should be much simpler to define all providers with the same GitHubRunners instance.

Oops! Now that I read the documentation and my code in light of your comment, I don't know why I didn't see this before!!

Thank you so much for the quick response and for your assistance!

kichik commented 5 months ago

I'm not sure if I understood your comment 100%, but I don't know if that's possible with GithubApps. As far as I can tell, Github apps can only have one webhook URL per App.

Good point. You should be able to create normal non-app webhooks though. They should work as well.

Oops! Now that I read the documentation and my code in light of your comment, I don't know why I didn't see this before!!

Thank you so much for the quick response and for your assistance!

Perfect. Glad I could help.

FWIW I have never tried it or even considered, but it should technically be possible to define providers in different stacks to be used by the same GitHubRunners. I'm sure it's going to blow up in some spectacular manner I haven't thought of, but it might be an easy fix too.