Skip to content

feat(runners): merge launch template tags into the launch request tags - #5577

Open
seeeun-cho wants to merge 2 commits into
github-aws-runners:mainfrom
seeeun-cho:feat/propagate-runner-ec2-tags-to-fleet
Open

seeeun-cho wants to merge 2 commits into
github-aws-runners:mainfrom
seeeun-cho:feat/propagate-runner-ec2-tags-to-fleet

Conversation

@seeeun-cho

@seeeun-cho seeeun-cho commented Nov 5, 2026 •

Copy link
Copy Markdown

Description

Tags defined on the launch template (tags, runner_ec2_tags) are not part of the CreateFleet and RunInstances requests made by the scale-up and pool Lambdas, which only carry the module-owned ghr:* tags. Organization policies that evaluate aws:RequestTag (for example an SCP that denies ec2:RunInstances unless mandatory tags are present) therefore reject every launch, even when the tags are set in Terraform.

This change (following the review suggestion):

  • describes the $Default version of the launch template used for the request and reads its instance and volume tag specifications;
  • merges them into the request tag specifications on both the CreateFleet and RunInstances paths (the fleet tags use the instance tags);
  • applies module-owned ghr:* tags last, so they take precedence;
  • falls back to the module-owned tags, with a warning, if the launch template cannot be described.

There are no Terraform changes: no new environment variable, and the scale-up role already has ec2:DescribeLaunchTemplateVersions.

Behavior note: each launch now makes one extra DescribeLaunchTemplateVersions call (two when the on-demand failover retries). Three existing failover tests asserted the position of CreateFleet in the overall call order, so their ordinals were updated.

Not covered: the experimental modules/compute-providers path, which has its own tag semantics. Happy to extend it if maintainers prefer.

Test Plan

  • Added unit tests in runners.test.ts: the $Default launch template version is read, template tags are merged into the instance, volume and fleet tags of CreateFleet, merged into RunInstances, module-owned ghr:* tags take precedence, and fallback when the template cannot be described. The merge tests fail without the change to runners.ts.
  • All EC2 library tests pass (343/343). ESLint and Prettier are clean.
  • Not yet tested against a live AWS account or an SCP.

Related Issues

None found.

🤖 Generated with Claude Code

@seeeun-cho
seeeun-cho force-pushed the feat/propagate-runner-ec2-tags-to-fleet branch from 5a3f7de to e6aef8b Compare November 5, 2026 09:53
@seeeun-cho
seeeun-cho marked this pull request as ready for review November 5, 2026 09:56
@seeeun-cho
seeeun-cho requested review from a team as code owners November 5, 2026 09:56
…equests

runner_ec2_tags was only applied to the launch template tag specifications.
CreateFleet and RunInstances requests carried only the module-owned ghr:* tags,
so organization policies that evaluate aws:RequestTag (for example SCPs that
deny ec2:RunInstances unless mandatory tags are present) rejected every
launch even when runner_ec2_tags contained the required tags.

Pass runner_ec2_tags to the scale-up and pool lambdas as RUNNER_EC2_TAGS and
merge them into the instance, volume and fleet tags on both the CreateFleet
and RunInstances paths. Module-owned ghr:* tags are applied last so callers
cannot override them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@seeeun-cho
seeeun-cho force-pushed the feat/propagate-runner-ec2-tags-to-fleet branch from e6aef8b to 5ad3fbd Compare November 5, 2026 10:02
@seeeun-cho
seeeun-cho marked this pull request as draft November 5, 2026 10:35
@seeeun-cho
seeeun-cho marked this pull request as ready for review November 5, 2026 10:35
@edersonbrilhante

edersonbrilhante commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

@seeeun-cho How about describe the launch template and get the tags specifications and merge the tags defined in ts code with the tags defined in the tf code?

…ER_EC2_TAGS

Address review feedback: instead of passing runner_ec2_tags to the Lambdas via
a new RUNNER_EC2_TAGS environment variable, describe the default version of the
launch template used for the request and merge its instance and volume tag
specifications into the CreateFleet and RunInstances tag specifications.

This removes the Terraform changes (no new environment variable, no pool or
scale-up wiring) and also covers tags defined through the tags variable.
Module-owned ghr:* tags are still applied last and take precedence. If the
launch template cannot be described, only the module-owned tags are sent.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@seeeun-cho seeeun-cho changed the title feat(runners): send runner_ec2_tags on the scale-up and pool launch requests feat(runners): merge launch template tags into the launch request tags Nov 5, 2026
@seeeun-cho

Copy link
Copy Markdown
Author

Hi @edersonbrilhante, thanks for the suggestion.
Reworked: The Lambda now retrieves the launch template's default version and merges its instance and volume tag specifications into the CreateFleet/RunInstances request tags. Existing ghr:* tags take precedence. If the launch template cannot be described, the Lambda falls back to ghr:* tags only.

This branch has not been deployed

No deployments
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