Skip to content

feat(runner): add source parameter to distinguish between scale-up and pool lambda#5054

Merged
stuartp44 merged 3 commits intomainfrom
stu/fix_naming_issue
Mar 30, 2026
Merged

feat(runner): add source parameter to distinguish between scale-up and pool lambda#5054
stuartp44 merged 3 commits intomainfrom
stu/fix_naming_issue

Conversation

@stuartp44
Copy link
Copy Markdown
Contributor

@stuartp44 stuartp44 commented Mar 3, 2026

Fixes #5053

This pull request updates the way runner creation is tracked and tagged by introducing an explicit source parameter to distinguish between runners created by the scale-up lambda and those created by the pool lambda. The changes ensure that the runner creation flow and related tests consistently use this new source field.

Runner creation and tagging improvements:

  • Added a source field ('scale-up-lambda' | 'pool-lambda') to RunnerConfig, RunnerInputParameters, and related test interfaces to explicitly track the origin of runner creation. [1] [2] [3]
  • Updated the runner creation logic in createInstances and createRunners to use the new source field for the ghr:created_by tag, replacing previous logic based on runner count. [1] [2]

Test enhancements:

  • Modified and added tests in runners.test.ts to verify correct behaviour when the source parameter is specified, including both single and multiple instance fleet creation. [1] [2] [3] [4] [5]
  • Updated pool adjustment tests to pass the source argument and verify its usage in runner creation calls. [1] [2] [3] [4]

Pool and scaling logic:

  • Changed the pool adjustment logic in pool.ts to always pass 'pool-lambda' as the source when topping up the pool.
  • Ensured scale-up runner logic in scale-up.test.ts and related code passes 'scale-up-lambda' as the source for created runners.

These changes collectively improve the clarity and reliability of runner source tracking throughout the control-plane codebase.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 3, 2026

Dependency Review

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

Scanned Files

None
@Brend-Smits Brend-Smits force-pushed the stu/fix_naming_issue branch from 481be88 to 9582e4d Compare March 6, 2026 12:49
@npalm
Copy link
Copy Markdown
Member

npalm commented Mar 9, 2026

@stuartp44 can you make also clear what bug / issue is addressed. I think the batch intruduced to handle scaling is causing runners are marekd with pool instead of scale-up

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves runner origin tracking in the control-plane by introducing an explicit source field that distinguishes between runners created by the scale-up lambda vs the pool lambda, and uses that field to drive the ghr:created_by EC2 tag.

Changes:

  • Added source: 'scale-up-lambda' | 'pool-lambda' to runner input/config types and threaded it through runner creation calls.
  • Updated EC2 instance tagging to set ghr:created_by from runnerParameters.source instead of inferring from runner count.
  • Updated/added tests to assert the new source behavior for both pool top-ups and fleet creation.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lambdas/functions/control-plane/src/scale-runners/scale-up.ts Extends createRunners to accept and forward a source value (defaulting to scale-up-lambda).
lambdas/functions/control-plane/src/scale-runners/scale-up.test.ts Updates expected runner parameters to include source.
lambdas/functions/control-plane/src/pool/pool.ts Passes 'pool-lambda' when creating runners during pool top-up.
lambdas/functions/control-plane/src/pool/pool.test.ts Updates expectations to include the new source argument in createRunners calls.
lambdas/functions/control-plane/src/aws/runners.ts Sets the EC2 tag ghr:created_by directly from runnerParameters.source.
lambdas/functions/control-plane/src/aws/runners.test.ts Adds/updates tests to validate correct tagging for both scale-up-lambda and pool-lambda sources.
lambdas/functions/control-plane/src/aws/runners.d.ts Adds the source field to RunnerInputParameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stuartp44
Copy link
Copy Markdown
Contributor Author

@npalm its in the issue attached. TLDR, it's because we have some runner types that do not have pools but are getting tagged with created by "pool-lambda", which is incorrect.

guicaulada
guicaulada previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Contributor

@guicaulada guicaulada left a comment

Choose a reason for hiding this comment

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

Looks good to me! The change is well-scoped and well-tested.

Making source explicit feels better than relying on numberOfRunners.

I have a few minor suggestions and questions, but no blockers.

If you could link the issue directly on the PR body (e.g. Fixes #5053) it would make it easier to find.

Comment thread lambdas/functions/control-plane/src/scale-runners/scale-up.ts Outdated
Comment thread lambdas/functions/control-plane/src/scale-runners/scale-up.ts
Comment thread lambdas/functions/control-plane/src/aws/runners.test.ts
@stuartp44 stuartp44 force-pushed the stu/fix_naming_issue branch from b309a04 to a68d5f2 Compare March 18, 2026 15:27
@stuartp44 stuartp44 requested a review from guicaulada March 18, 2026 15:28
@stuartp44 stuartp44 requested review from npalm and removed request for guicaulada March 30, 2026 09:18
@stuartp44 stuartp44 merged commit efbaa6f into main Mar 30, 2026
10 checks passed
@stuartp44 stuartp44 deleted the stu/fix_naming_issue branch March 30, 2026 10:14
Brend-Smits pushed a commit that referenced this pull request Apr 1, 2026
npalm added a commit that referenced this pull request Apr 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.6.0](v7.5.0...v7.6.0)
(2026-04-01)


### Features

* **runner:** add source parameter to distinguish between scale-up and
pool lambda
([#5054](#5054))
([efbaa6f](efbaa6f))


### Bug Fixes

* **lambda:** bump flatted from 3.3.1 to 3.4.2 in /lambdas
([#5075](#5075))
([67a70d7](67a70d7))
* **lambda:** bump path-to-regexp from 8.2.0 to 8.4.0 in /lambdas
([#5082](#5082))
([25ec471](25ec471))
* **lambda:** bump the aws group in /lambdas with 7 updates
([#5071](#5071))
([c3dcce2](c3dcce2))
* **logging:** update log_class to log_group_class in CloudWatch agent
configuration
([#5073](#5073))
([6d3b7db](6d3b7db))

---
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: Niek Palm <npalm@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

5 participants