Skip to content

Commit 4b17154

Browse files
committed
chore: parameter to opt-in to feature
1 parent e3433b8 commit 4b17154

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

templates/aws-stack.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Metadata:
6060
- BuildkiteAgentScalerServerlessARN
6161
- BuildkiteAgentScalerVersion
6262
- LogRetentionDays
63+
- BuildkiteAgentEnableGracefulShutdown
6364

6465
- Label:
6566
default: Network Configuration
@@ -210,6 +211,14 @@ Parameters:
210211
Description: The number of days to retain the Cloudwatch Logs of the lambda.
211212
Default: "1"
212213

214+
BuildkiteAgentEnableGracefulShutdown:
215+
Description: Set to true to enable graceful shutdown of agents when the ASG is updated with replacement. This allows ASGs to be removed in a timely manner during an in-place update of the elastic stack, and allows remaining agents to finish jobs without interruptions.
216+
Type: String
217+
AllowedValues:
218+
- "true"
219+
- "false"
220+
Default: "false"
221+
213222
BuildkiteAgentTracingBackend:
214223
Description: The tracing backend to use for CI tracing. See https://buildkite.com/docs/agent/v3/tracing
215224
Type: String
@@ -818,6 +827,9 @@ Conditions:
818827
UseCostAllocationTags:
819828
!Equals [ !Ref EnableCostAllocationTags, "true" ]
820829

830+
EnableBuildkiteAgentGracefulShutdown:
831+
!Equals [ !Ref BuildkiteAgentEnableGracefulShutdown, "true" ]
832+
821833
UsePipelineSigningKMSKey:
822834
!Not [ !Equals [ !Ref PipelineSigningKMSKeyId, "" ] ]
823835

@@ -1729,6 +1741,7 @@ Resources:
17291741

17301742
StopBuildkiteAgentsRole:
17311743
Type: AWS::IAM::Role
1744+
Condition: EnableBuildkiteAgentGracefulShutdown
17321745
Properties:
17331746
PermissionsBoundary:
17341747
!If [
@@ -1780,6 +1793,7 @@ Resources:
17801793

17811794
StopBuildkiteAgentsFunction:
17821795
Type: AWS::Lambda::Function
1796+
Condition: EnableBuildkiteAgentGracefulShutdown
17831797
Properties:
17841798
Description: "Gracefully stops all Buildkite agents in a given Auto Scaling group."
17851799
Code:
@@ -1852,6 +1866,7 @@ Resources:
18521866

18531867
StopBuildkiteAgents:
18541868
Type: AWS::CloudFormation::CustomResource
1869+
Condition: EnableBuildkiteAgentGracefulShutdown
18551870
Version: 1.0
18561871
Properties:
18571872
ServiceToken: !GetAtt StopBuildkiteAgentsFunction.Arn

0 commit comments

Comments
 (0)