Skip to content

fix: preserve token TTL and runner identity in v2 - #5594

Open
guicaulada wants to merge 1 commit into
mainfrom
gc/fix-v2-token-ttl-runner-identity
Open

guicaulada wants to merge 1 commit into
mainfrom
gc/fix-v2-token-ttl-runner-identity

Conversation

@guicaulada

Copy link
Copy Markdown
Contributor

Description

Migrating from v1 to multi-runner-v2 in v8.1.1 silently drops two settings:

  • storage_provider.aws.ssm.ttl_seconds.tokens is accepted by multi-runner but discarded by the runner-config input schema. Scale-up and pool lose SSM_TOKEN_TTL_SECONDS, so newly written registration-token/JIT parameters no longer receive the configured expiration policy.
  • The EC2 provider omits ghr:registered_runner_name_prefix, which the termination watcher uses for exact-name lookup when no runner ID is available.

Preserve the TTL through runner-config and pass it to both Lambdas through the existing storage-provider environment-variable contract. Leave the variable absent when TTL is unset and reject non-positive values. Add the module-controlled identity tag using runner.name_prefix, which v2 uses for both JIT and bootstrap registration; user tags cannot override it.

Test Plan

  • Reproduced the missing TTL with a failing regression test before the fix.
  • Runner-config Terraform suite: 25 passed, covering configured/unset TTL and rejection of zero/negative values.
  • EC2 provider Terraform suite: 10 passed, including a conflicting user tag to verify the registered prefix remains module-controlled.

Related Issues

Preserves the runner identity metadata introduced in #5573 for the v2 EC2 provider.

@guicaulada
guicaulada requested a review from a team as a code owner November 16, 2026 17:45
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

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

Scanned Files

None

Copilot AI 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.

🟡 Changes recommended

The TTL validation accepts fractional values such as 0.5 that parseInt truncates to zero, causing both scale-up and pool to fail at runtime despite a successful Terraform plan/apply.

1 open issue
What changed in this PR

This PR restores token expiration settings and runner identity metadata lost when migrating to multi-runner-v2, preserving runtime cleanup behavior and the termination watcher's exact-name lookup.

Changes:

  • Preserve optional token TTL settings through runner-config and forward them to scale-up and pool.
  • Add a module-controlled registered-runner prefix tag that user tags cannot override.
  • Add Terraform regression coverage and document the TTL input.
File Description
modules/​runner-config/​variables.tf Adds the optional token TTL input and positive-value validation.
modules/​runner-config/​tests/​pool.tftest.hcl Tests configured, unset, zero, and negative TTL values.
modules/​runner-config/​README.md Documents the TTL setting and updates the input schema.
modules/​runner-config/​orchestration-provider.tf Passes configured TTL values to scale-up and pool.
modules/​compute-providers/​aws/​ec2/​tests/​provider.tftest.hcl Verifies that user tags cannot override the registered prefix.
modules/​compute-providers/​aws/​ec2/​runner-instances.tf Adds the protected identity tag used by the termination watcher.

Review effort: Balanced

Comment on lines +209 to +210
condition = var.storage_provider.aws.ssm.ttl_seconds.tokens == null ? true : var.storage_provider.aws.ssm.ttl_seconds.tokens > 0
error_message = "`storage_provider.aws.ssm.ttl_seconds.tokens` must be a positive number."

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