Skip to content

Commit

Permalink
Change EventScheduleRate parameter to EventSchedulePeriod and fix rat…
Browse files Browse the repository at this point in the history
…e expression

The rate expression must pluralise the unit, so `1 minute` and `0 minutes` are valid, but `0 minute` is not.
  • Loading branch information
triarius committed Aug 28, 2023
1 parent 4794fdf commit bcb432f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Parameters:
Type: String
Default: ''

EventScheduleRate:
EventSchedulePeriod:
Description: How often the Event Schedule is triggered (in minutes)
Type: String
Type: Number
Default: "1"

AgentsPerInstance:
Expand Down Expand Up @@ -89,7 +89,7 @@ Parameters:
Type: Number
Description: The number of pages to retrive for DescribeScalingActivity. Negative numbers mean unlimited.
Default: "-1"

MinPollInterval:
Type: String
Description: Minimum time interval between polls. If a larger interval is provided by Buildkite, that is used instead.
Expand All @@ -102,6 +102,8 @@ Conditions:
!Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStoreKMSKey, "" ] ]
SetRolePermissionsBoundaryARN:
!Not [ !Equals [ !Ref RolePermissionsBoundaryARN, "" ] ]
EventSchedulePeriodIsOne:
!Equals [ !Ref EventSchedulePeriod, "1" ]

Mappings:
LambdaBucket:
Expand Down Expand Up @@ -213,7 +215,7 @@ Resources:
Timer:
Type: Schedule
Properties:
Schedule: !Sub "rate(${EventScheduleRate} minute)"
Schedule: !If [ EventSchdulePeriodIsOne, "rate(1 minute)", !Sub "rate(${EventSchedulePeriod} minutes)"]

# This mirrors the group that would be created by the lambda, but enforces
# a retention period and also ensures it's removed when the stack is removed
Expand Down

0 comments on commit bcb432f

Please sign in to comment.