Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/pkg/clouds/aws/ecs/cfn/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ func createTemplate(stack string, containers []types.Container, overrides Templa
VersioningConfiguration: &s3.Bucket_VersioningConfiguration{
Status: "Enabled",
},
LifecycleConfiguration: &s3.Bucket_LifecycleConfiguration{
Rules: []s3.Bucket_Rule{
{
Status: "Enabled",
NoncurrentVersionExpiration: &s3.Bucket_NoncurrentVersionExpiration{
// Deletion only happens when both NoncurrentDays and NewerNoncurrentVersions are exceeded
// See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html
NoncurrentDays: 10, // Keep deployments for at least 10 days
NewerNoncurrentVersions: ptr.Int(10), // Keep last 10 deployments
Comment on lines +94 to +95
Copy link
Preview

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Extract the literal 10 into a named constant (e.g., retentionDays or maxVersions) to avoid magic numbers and simplify future updates.

Suggested change
NoncurrentDays: 10, // Keep deployments for at least 10 days
NewerNoncurrentVersions: ptr.Int(10), // Keep last 10 deployments
NoncurrentDays: retentionDays, // Keep deployments for at least 10 days
NewerNoncurrentVersions: ptr.Int(maxVersions), // Keep last 10 deployments

Copilot uses AI. Check for mistakes.

},
},
},
},
}

// 2. ECS cluster
Expand Down