Skip to content

feat(github-app): allow several github apps to be used - #5269

Merged
guicaulada merged 8 commits into
mainfrom
gc/feat/multi-github-app-support
Aug 14, 2026
Merged

feat(github-app): allow several github apps to be used#5269
guicaulada merged 8 commits into
mainfrom
gc/feat/multi-github-app-support

Conversation

@guicaulada

Copy link
Copy Markdown
Contributor

Description

Supersedes #5038 by @thomasnemer, whose branch lives in an org-owned fork that maintainers cannot push to. This PR rebases that work onto current main (porting it to the compute-provider architecture introduced in #5234/#5267) and addresses the review feedback on #5038. All of Thomas's work is preserved with co-authorship.

From the original PR:

  • New additional_github_apps variable (optional, no breaking changes) accepts extra GitHub Apps with id, key_base64, and optionally installation_id (direct values or SSM references).
  • The control-plane lambdas (scale-up, scale-down, pool, job-retry) select one app per invocation and thread the selection through the JWT → installation token → API call chain, spreading load across N × 15,000 req/hour rate-limit buckets.
  • Installation ID resolution: pre-configured installation_id wins, the primary app reuses the webhook payload's id, API lookup is the fallback.

Changes on top of #5038:

  • Ported to the compute-provider layout: the appIndex selection lives in the orchestrators (scale-up.ts, pool.ts, scale-down.ts) and flows to providers via CreateGitHubRunnerConfig.appIndex, so provider interfaces are unchanged.
  • Restored the 404 stale-installation fallback (review feedback): when installation auth fails with 404 (app uninstalled/reinstalled while messages were in flight), the flow re-resolves the installation via the API and retries once with the same app. This now also covers stale pre-configured installation ids, and has regression tests in octokit.test.ts.
  • Updated env wiring for the COMPUTE_PROVIDER_TYPE era and regenerated module docs.

Test Plan

  • vitest: control-plane 348 passed, compute-providers 270 passed, webhook 89 passed.
  • New regression tests: stale-payload 404 retry, same-id rethrow, non-404 rethrow.
  • ESLint and Prettier clean on all touched packages.
  • terraform fmt -check -recursive, terraform validate (root, runners, multi-runner, ssm), terraform test in modules/runners (1 passed).
  • READMEs regenerated with terraform-docs.

Related Issues

Closes #5037. Supersedes #5038.

Co-authored with @thomasnemer.

thomasnemer and others added 8 commits July 22, 2026 18:31
…tftest

- Restore iam_overrides conditional and aws_iam_role.runner[0].arn index
  in scale-up IAM policy (dropped during conflict resolution)
- Update pool.tftest.hcl github_app_parameters to list format
- modules/ssm/outputs.tf: use tostring(idx) when indexing for_each
  resources keyed by stringified indices; bare numeric [idx] would fail
  with an invalid-index error when additional_github_apps is non-empty
- pool.ts: pass appIdx as trailing arg to createRunners so pool-originated
  JIT-config rate-limit metrics are attributed to the correct app rather
  than always defaulting to app 0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…termination-watcher list mismatch

The local.github_app_parameters restructure (id/key_base64 became lists,
index 0 = primary app) silently broke four consumers of the old single-object
shape, none caught by CI since validate defers value evaluation:

- outputs.tf: ssm_parameters iterated lists as objects (v.name on a list
  fails at plan/apply); replace with merge() that keeps the upstream keys
  id/key_base64/webhook_secret pointing at the primary app plus the new
  per-app github_app_id_<idx>/github_app_key_base64_<idx>/github_app_webhook_secret keys
- modules/multi-runner/outputs.tf: add the same backward-compat keys to the
  existing merge() so external consumers indexing the old keys keep working
- main.tf + modules/multi-runner/termination-watcher.tf: pass id[0]/key_base64[0]
  (primary app single object) instead of the full list to the termination-watcher
  module input typed map(string)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge PR #5038 onto main, porting the multi-app changes to the
compute-provider architecture and restoring the stale-installation
404 fallback.

Co-authored-by: Thomas Nemer <thomas.nemer@doctolib.com>
@guicaulada
guicaulada requested review from a team as code owners August 14, 2026 11:21
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@Brend-Smits Brend-Smits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM :shipit:! Thanks for picking this up! Also thanks to @thomasnemer 🚀

@guicaulada
guicaulada merged commit 82cb0fd into main Aug 14, 2026
44 checks passed
@guicaulada
guicaulada deleted the gc/feat/multi-github-app-support branch August 14, 2026 12:21
Brend-Smits pushed a commit that referenced this pull request Aug 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.11.0](v7.10.2...v7.11.0)
(2026-08-14)


### Features

* **github-app:** allow several github apps to be used
([#5269](#5269))
([82cb0fd](82cb0fd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: runners-releaser[bot] <194412594+runners-releaser[bot]@users.noreply.github.com>
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.

Support for multiple GitHub Apps to overcome API rate limits at scale

3 participants