Skip to content

Commit f6dd5cf

Browse files
feat(ecr): image tag mutability exclusion filters (#35246)
### Issue # (if applicable) Closes #35454 ### Reason for this change AWS ECR now supports for image tag mutability exclusion filters but AWS CDK L2 construct does not support this feature yet. ### Description of changes - add `imageTagMutabilityExclusionFilters` prop to `RepositoryProps` - update `TagMutability` enum - define `ImageTagMutabilityExclusionFilter` class - While `ImageTagMutabilityExclusionFilterType` currently supports only `WILDCARD`, future additions are anticipated. Factory method-based instance creation has been implemented to ensure user convenience and future extensibility. - https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-ecr-repository-imagetagmutabilityexclusionfilter.html#aws-properties-ecr-repository-imagetagmutabilityexclusionfilter-properties ### Describe any new or updated permissions being added None ### Description of how you validated changes Add both unit and integ tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c57484a commit f6dd5cf

12 files changed

+1078
-2
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.tag-mutability-exclusion.js.snapshot/aws-ecr-tag-mutability-exclusion-stack.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"Resources": {
3+
"ImmutableRepoWithExclusions905B5191": {
4+
"Type": "AWS::ECR::Repository",
5+
"Properties": {
6+
"EmptyOnDelete": true,
7+
"ImageTagMutability": "IMMUTABLE_WITH_EXCLUSION",
8+
"ImageTagMutabilityExclusionFilters": [
9+
{
10+
"ImageTagMutabilityExclusionFilterType": "WILDCARD",
11+
"ImageTagMutabilityExclusionFilterValue": "dev-*"
12+
},
13+
{
14+
"ImageTagMutabilityExclusionFilterType": "WILDCARD",
15+
"ImageTagMutabilityExclusionFilterValue": "test-*"
16+
}
17+
]
18+
},
19+
"UpdateReplacePolicy": "Delete",
20+
"DeletionPolicy": "Delete"
21+
},
22+
"MutableRepoWithExclusions16D45AB8": {
23+
"Type": "AWS::ECR::Repository",
24+
"Properties": {
25+
"EmptyOnDelete": true,
26+
"ImageTagMutability": "MUTABLE_WITH_EXCLUSION",
27+
"ImageTagMutabilityExclusionFilters": [
28+
{
29+
"ImageTagMutabilityExclusionFilterType": "WILDCARD",
30+
"ImageTagMutabilityExclusionFilterValue": "prod-*"
31+
},
32+
{
33+
"ImageTagMutabilityExclusionFilterType": "WILDCARD",
34+
"ImageTagMutabilityExclusionFilterValue": "release-v*"
35+
}
36+
]
37+
},
38+
"UpdateReplacePolicy": "Delete",
39+
"DeletionPolicy": "Delete"
40+
}
41+
},
42+
"Parameters": {
43+
"BootstrapVersion": {
44+
"Type": "AWS::SSM::Parameter::Value<String>",
45+
"Default": "/cdk-bootstrap/hnb659fds/version",
46+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
47+
}
48+
},
49+
"Rules": {
50+
"CheckBootstrapVersion": {
51+
"Assertions": [
52+
{
53+
"Assert": {
54+
"Fn::Not": [
55+
{
56+
"Fn::Contains": [
57+
[
58+
"1",
59+
"2",
60+
"3",
61+
"4",
62+
"5"
63+
],
64+
{
65+
"Ref": "BootstrapVersion"
66+
}
67+
]
68+
}
69+
]
70+
},
71+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
72+
}
73+
]
74+
}
75+
}
76+
}

packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.tag-mutability-exclusion.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.tag-mutability-exclusion.js.snapshot/cdkecrtagmutabilityexclusiontestDefaultTestDeployAssertD78326B1.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.tag-mutability-exclusion.js.snapshot/cdkecrtagmutabilityexclusiontestDefaultTestDeployAssertD78326B1.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.tag-mutability-exclusion.js.snapshot/integ.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)