Skip to content

Support Time Zone for Runner Pool #4056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janslow opened this issue Aug 12, 2024 · 1 comment · Fixed by #4063
Closed

Support Time Zone for Runner Pool #4056

janslow opened this issue Aug 12, 2024 · 1 comment · Fixed by #4063
Labels
enhancement New feature or request

Comments

@janslow
Copy link
Contributor

janslow commented Aug 12, 2024

Hey, thanks for the work you've done on this project (and for open sourcing it)!

Would you consider adding support for providing the Time Zone as part of the pool_config variable?

For context, we want to keep a pool of runners ready during office hours, but we'd currently need to convert the pool_config[*].schedule_expression to UTC and update that whenever the clocks change (e.g., I'm in the UK, where the start/end of "British Summer Time" changes every year).

Workaround

Unfortunately, AWS EventBridge Rules (currently used to trigger the pool function) don't support time zones, but AWS EventBridge Scheduler does. This feature is a drop-in replacement for EventBridge Rules (including the cron expression) and the same price.

My current workaround is to define the aws_scheduler_schedule resources outside the GitHub runners module and trigger the pool Lambda, but that has a couple of issues:

  • It relies on implementation details of your module, so may break in the future (specifically, the payload to pass to the pool function)
  • At least one pool_config expression is required, otherwise the pool resources aren't created

Proposal

  1. Add an optional time_zone property to the pool_config variable
  2. Replace the use of aws_cloudwatch_event_rule in the pool module with aws_scheduler_schedule (and a single aws_scheduler_schedule_group and aws_iam_role), setting schedule_expression_timezone if necessary.

Alternatively, dynamically switch between aws_cloudwatch_event_rule and aws_scheduler_schedule, depending on whether the time_zone is set. This would increase the complexity of the module, but would avoid making any changes to existing users.

If you'd consider accepting one of these as a PR, I can look at implementing one of them.

@stuartp44 stuartp44 added the enhancement New feature or request label Aug 13, 2024
@stuartp44
Copy link
Contributor

For us within Philips, this is not much of issue. I can see where the suggestion will help reduce arbitrary code to workaround this issue. Any contributions are more than welcome!

janslow added a commit to janslow/terraform-aws-github-runner that referenced this issue Aug 13, 2024
Fixes github-aws-runners#4056

Replaces the `aws_cloudwatch_event_rule` in the `pool` module (which only support UTC) with `aws_scheduler_schedule`, which supports arbitrary time zones via the `schedule_expression_timezone` attribute.

The AWS EventBridge Scheduler is a drop in replacement for scheduler based AWS EventBridge Rules ([see AWS blog post](https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/)), including the expression syntax and pricing.

The timezone can be set via the `schedule_expression_timezone` property via the main module or `multi-runners` module.
@npalm npalm closed this as completed in b8f9eb4 Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants