Skip to content

refactor(runners): introduce provider plugin framework - #5234

Merged
edersonbrilhante merged 21 commits into
mainfrom
test-runner-provider-framework
Aug 4, 2026
Merged

edersonbrilhante merged 21 commits into
mainfrom
test-runner-provider-framework

Conversation

@edersonbrilhante

@edersonbrilhante edersonbrilhante commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

Introduce a shared runner-provider plugin framework so a provider is enabled once and its webhook, scale-up, scale-down, pool, and runner-resource capabilities are available through one registry facade.

  • Move the EC2 provider implementation into the shared runner-providers library.
  • Add a single provider configuration and capability registry for webhook and control-plane consumers.
  • Add reusable scale-up, scale-down, and pool contract tests that run for every enabled provider lane.
  • Add a provider skeleton that documents the interfaces required to implement another lane.

This reduces the number of control-plane and webhook locations that must be changed when adding a runner provider.

Follow-up work

Some tests still need to move to the control-plane package instead of remaining with the EC2 plugin. The affected files contain groups of tests, so this cleanup requires moving individual test cases rather than relocating an entire block or file. It will be handled in a follow-up PR to keep this refactor reviewable.

This is why some EC2 provider tests currently import from ../../../../../../functions/control-plane. Those dependencies should be removed in the follow-up PR.

Test Plan

  • Ran the runner-providers:test Nx target.
  • Ran the control-plane:test Nx target.
  • Ran Prettier checks for the runner-provider library.
  • Ran ESLint for the runner-provider library.

Related Issues

Follow-up: #5236.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 5 package(s) with unknown licenses.
See the Details below.

License Issues

lambdas/functions/control-plane/package.json

PackageVersionLicenseIssue Type
@aws-github-runner/runner-providersNullUnknown License

lambdas/functions/webhook/package.json

PackageVersionLicenseIssue Type
@aws-github-runner/runner-providersNullUnknown License

lambdas/libs/runner-providers/package.json

PackageVersionLicenseIssue Type
@aws-github-runner/aws-powertools-utilNullUnknown License
@aws-github-runner/aws-ssm-utilNullUnknown License
@aws-sdk/client-ec2^3.1009.0NullUnknown License

OpenSSF Scorecard

Scorecard details
PackageVersionScoreDetails
npm/@aws-github-runner/runner-providers UnknownUnknown
npm/@aws-github-runner/runner-providers UnknownUnknown
npm/@aws-github-runner/aws-powertools-util UnknownUnknown
npm/@aws-github-runner/aws-ssm-util UnknownUnknown
npm/@aws-sdk/client-ec2 ^3.1009.0 UnknownUnknown
npm/@octokit/rest 22.0.1 🟢 7.2
Details
CheckScoreReason
Maintained🟢 1022 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Code-Review⚠️ -1Found no human activity in the last 30 changesets
Binary-Artifacts🟢 10no binaries found in the repo
Security-Policy🟢 9security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 6dependency not pinned by hash detected -- score normalized to 6
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Packaging🟢 10packaging workflow detected
SAST🟢 10SAST tool is run on all commits
npm/aws-sdk-client-mock ^4.1.0 UnknownUnknown
npm/aws-sdk-client-mock-jest ^4.1.0 UnknownUnknown
npm/moment 2.29.4 🟢 4.5
Details
CheckScoreReason
Maintained🟢 57 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Code-Review⚠️ 1Found 4/30 approved changesets -- score normalized to 1
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Packaging⚠️ -1packaging workflow not detected
Security-Policy🟢 10security policy file detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
npm/nock ^14.0.10 UnknownUnknown
npm/yn 3.1.1 🟢 3.9
Details
CheckScoreReason
Code-Review🟢 4Found 12/30 approved changesets -- score normalized to 4
Packaging⚠️ -1packaging workflow not detected
Security-Policy🟢 10security policy file detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Signed-Releases⚠️ -1no releases found
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • lambdas/functions/control-plane/package.json
  • lambdas/functions/webhook/package.json
  • lambdas/libs/runner-providers/package.json

@edersonbrilhante
edersonbrilhante marked this pull request as ready for review July 31, 2026 19:36
@edersonbrilhante
edersonbrilhante requested a review from a team as a code owner July 31, 2026 19:36

@guicaulada guicaulada 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! The only change in the relocated EC2 modules is the createStartRunnerConfig injection, the orchestrators changed only their registry call sites, and no test cases were lost with two additions to replace the deleted registry test. The contract-test lanes and the compile-checked template are nice.

Requesting changes for one reason: the shared providers.config.ts/core import chain pulls the full EC2 control-plane implementation and the EC2 SDK into the webhook bundle.

Splitting the config and registry per lane fixes it while keeping the "enable a provider in one place" goal. The core/config layering and the positional default provider are strong suggestions, the rest is minor.

@guicaulada guicaulada 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.

Thank you for addressing my concerns! LGTM!

@edersonbrilhante
edersonbrilhante merged commit 34d63fb into main Aug 4, 2026
9 checks passed
@edersonbrilhante
edersonbrilhante deleted the test-runner-provider-framework branch August 4, 2026 14:59
edersonbrilhante added a commit that referenced this pull request Aug 12, 2026
…ests (#5246)

## Description

- Move generic scale-up and scale-down orchestration tests from the EC2
provider package into the control-plane package.
- Test orchestration through the runner-provider interfaces and
registry.
- Keep EC2 resource operations and dynamic configuration coverage beside
the EC2 provider.
- Remove direct EC2 provider test imports and mocks of control-plane
modules.

Production behavior is unchanged.

## Test Plan

- `cd lambdas && yarn test` (all 8 projects passed)
- Focused control-plane suites: 226 tests passed
- Focused EC2 provider suites: 158 tests passed
- ESLint and Prettier checks passed for control-plane and
runner-providers
- Exact test-title inventory: 276 before and after, with no additions or
removals
- `git diff --check`

## Related Issues

Closes #5236

Follow-up to #5234
guicaulada added a commit that referenced this pull request Aug 14, 2026
## 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](#5038 (review))):
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.

---------

Co-authored-by: Thomas Nemer <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[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.

2 participants