Repository navigation
feat(webhook): support multi-region SQS dispatch in runner webhook - #5099
Merged
edersonbrilhante merged 3 commits intoJul 13, 2026
Conversation
This was referenced May 13, 2026
edersonbrilhante
requested changes
Jul 3, 2026
edersonbrilhante
left a comment
Contributor
There was a problem hiding this comment.
@bogdankrasko Can you please sign the commits?
Derive the SQS client region from the queue URL instead of always using AWS_REGION. This prevents cross-region SignatureDoesNotMatch failures when the webhook sends messages to queues outside the Lambda region. Cache traced SQS clients by region to avoid recreating clients for repeated sends, while still creating separate clients for different queue regions. Fall back to AWS_REGION when the queue URL cannot be parsed, and fall back to the SDK default region resolution when no region is available. Expand unit coverage for queue URL region parsing, AWS_REGION fallback, missing-region behavior, same-region client reuse, and per-region client separation.
bogdankrasko
force-pushed
the
pr/bk/update-dispatch-runner-lambda-sqs-multi-region
branch
from
July 8, 2026 14:50
c21be98 to
204dbcd
Compare
Contributor
Author
|
@edersonbrilhante Sure, signed the commits. Let me know if you have any questions regarding the changes. |
edersonbrilhante
previously approved these changes
Jul 10, 2026
Contributor
Author
|
@edersonbrilhante Fixed the linter issues |
edersonbrilhante
approved these changes
Jul 13, 2026
edersonbrilhante
added a commit
that referenced
this pull request
Jul 13, 2026
## Description Handle webhook events whose installationId belongs to a different GitHub App by retrying installation authentication after a 404. Apply the fallback in both the shared Octokit helper and the scale-up flow by re-resolving the installation ID for the current app before retrying auth. Preserve existing behavior for installationId=0 and non-404 errors, and add regression tests covering the mismatched installation/app scenario. ## Test Plan Follow the instructions in #5099 to deploy runners to multiple regions, and set the GitHub App secrets in SSM so that each region has its own GitHub App ID. ## Related Issues <!-- Link any related issues, e.g. Fixes #123, Closes #456 --> --------- Co-authored-by: Ederson Brilhante <[email protected]>
edersonbrilhante
pushed a commit
that referenced
this pull request
Jul 20, 2026
🤖 I have created a release *beep* *boop* --- ## [7.10.0](v7.9.0...v7.10.0) (2026-07-17) ### Features * **pool:** Allow to optionally include busy runners into the pool ([#5078](#5078)) ([c3eeb0f](c3eeb0f)) * **runners:** support OnDemandOptions.AllocationStrategy in EC2 Fleet ([#5077](#5077)) ([28b90f4](28b90f4)) * **termination-watcher:** deregister runners from GitHub on EC2 termination ([#5055](#5055)) ([c7494c1](c7494c1)) * **webhook:** support multi-region SQS dispatch in runner webhook ([#5099](#5099)) ([768d08b](768d08b)) ### Bug Fixes * **deps:** bump actions/stale from 10.3.0 to 10.4.0 in the github group ([#5210](#5210)) ([ef8719e](ef8719e)) * **deps:** bump github/codeql-action/upload-sarif from 4.36.2 to 4.36.3 ([#5207](#5207)) ([c7a8096](c7a8096)) * retry installation auth for regional GitHub App events ([#5123](#5123)) ([8222052](8222052)) --- 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> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the webhook SQS dispatch logic to select the SQS client region from the target queue URL instead of always using
AWS_REGION.This fixes cross-region dispatch scenarios where the webhook needs to send workflow job messages to an SQS queue in a different AWS region than the Lambda runtime. The change also caches SQS clients per region so repeated sends reuse the correct client while still creating separate clients when queues are in different regions.
To support this model, the webhook
runner_matcher_configmust include each runner group'smatcherConfigtogether with the region-specific SQS queue URL (id) and queue ARN (arn) for every runner group in every region. This allows the webhook to match the job and dispatch it to the correct regional queue.This also requires runner pool labels to be unique across all configured regions so webhook matching remains deterministic and a given job maps to exactly one regional queue.
Test Plan
lambdas/functions/webhook/src/sqs/index.test.tsto cover:AWS_REGIONwhen the queue URL cannot be parsedyarn vitest run functions/webhook/src/sqs/index.test.tsus-east-2, so a single API Gateway/webhook entrypoint handles workflow dispatch for runner queues across multiple AWS regionsmodules/runners. This setup provisions per-runner-group Lambda functions (scale-up, scale-down, pool, and job-retry), along with the SQS queues defined in modules/multi-runner/queues.tf. This was used to validate both same-region and cross-region dispatch behavior.To enable it, an additional wrapper was introduced within
modules/runnersto incorporate the required SQS queues.us-east-2: Ubuntu 24.04 runner pools for bothamd64andarm64. This region was used to validate that jobs with architecture-specific labels were matched correctly and dispatched successfully to queues in the local region.us-west-2: Ubuntu 24.04amd64-2runner pool. This region was used as the secondary-region target to validate that the webhook could dispatch a workflow job to an SQS queue outside the Lambda runtime region.Related Issues