You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Retry different subnet when runner deployment to one of them fails (#18)
We have been experiencing intermittent GitHub Actions runner provisioning failures where the runner Lambda is unable to create a new runner instance. These failures are typically caused by capacity-related issues, such as insufficient availability for a particular instance type or within the selected subnet.
This PR makes the `subnet` field in `RunnerConfiguration` a list and adds a fallback so the Lambda attempts runner creation in the next configured subnet (potentially a different AZ) when a recoverable error occurs.
## Core change
- `RunnerConfiguration.subnet` is now a JSON array (`["subnet-…"]`) instead of a single string.
- On a recoverable launch error the Lambda retries in the next configured subnet. Recoverable errors: `InsufficientFreeAddressesInSubnet`, `InsufficientInstanceCapacity`, `InvalidSubnetID.NotFound`, `Unsupported`.
## Hardening
- Validates the matched region has at least one configured subnet before attempting a launch.
- Preserves the underlying AWS error when all subnets are exhausted instead of returning a generic error.
- Guards against a nil `InstanceId` and logs the dereferenced instance ID (previously logged a pointer address).
- Caps the Lambda timeout at 29s to match the API Gateway REST integration timeout.
## Modernization / tooling
- Builds the `RunInstancesInput` once and mutates only the subnet per attempt (was rebuilt — and user data re-encoded — per subnet).
- Adopts Go 1.26 idioms (`errors.AsType`, `cmp.Or`, `slices.Contains`); `go.mod` bumped to `go 1.26`.
- golangci-lint: replaced deprecated `gomodguard` with `gomodguard_v2`; bumped `golangci-lint-action` to `v9`.
> [!IMPORTANT]
> **Breaking config change.** The `subnet` field must now be a JSON array. Existing deployments must update their `RunnerConfiguration` parameter from `"subnet":"subnet-…"` to `"subnet":["subnet-…"]` before/at deploy, otherwise the Lambda will fail to parse the configuration. README and `samconfig.example.yaml` are updated; deployed `samconfig.yaml` values must be migrated manually.
Co-Authored-By: Henry Skiba <henry.skiba@frgrisk.com>
0 commit comments