feat(ecr): image tag mutability exclusion filters#35246
feat(ecr): image tag mutability exclusion filters#35246mergify[bot] merged 35 commits intoaws:mainfrom
Conversation
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| const hasExclusionFilters = !!exclusionFilters; | ||
|
|
||
| if (hasExclusionFilters && !requiresExclusion) { | ||
| if (!tagMutability) { |
There was a problem hiding this comment.
This condition causes deployment error.
Resource handler returned message: "Invalid parameter at 'imageTagMutabilityExclusionFilters' failed to satisfy constraint: 'ImageTagMutabilityExclusionFilters are not allowed when imageTagMutability is set as null' (Service: Ecr, Status Code: 400, Request ID: 1a63b3a2-f3e8-491c-af9c-c869b094867e) (SDK Attempt Count: 1)" (RequestToken: 87f7cbaa-ce48-590e-cbed-0d4ae8139b5a, HandlerErrorCode: GeneralServiceException)| 'imageTagMutability must be specified when imageTagMutabilityExclusionFilters is provided.', | ||
| this, | ||
| ); | ||
| } else { |
There was a problem hiding this comment.
This condition causes deployment error.
Resource handler returned message: "Invalid parameter at 'imageTagMutabilityExclusionFilters' failed to satisfy constraint: 'ImageTagMutabilityExclusionFilters are not allowed when imageTagMutability is set as IMMUTABLE' (Service: Ecr, Status Code: 400, Request ID: 6044fe0c-4fbb-454a-934c-5c2e1a5c8d03) (SDK Attempt Count: 1)" (RequestToken: 11f4763e-09ed-e19f-272e-ec47a466170f, HandlerErrorCode: GeneralServiceException)
Resource handler returned message: "Invalid parameter at 'imageTagMutabilityExclusionFilters' failed to satisfy constraint: 'ImageTagMutabilityExclusionFilters are not allowed when imageTagMutability is set as MUTABLE' (Service: Ecr, Status Code: 400, Request ID: 80475a75-c3d4-4a8c-be4a-796dd2de2278) (SDK Attempt Count: 1)" (RequestToken: bec51a5b-8198-0aab-7a47-2cf59e44b0b3, HandlerErrorCode: GeneralServiceException)| } | ||
| } | ||
|
|
||
| if (requiresExclusion && !hasExclusionFilters) { |
There was a problem hiding this comment.
This condition causes deployment error.
Resource handler returned message: "Invalid parameter at 'imageTagMutabilityExclusionFilters' failed to satisfy constraint: 'ImageTagMutabilityExclusionFilters can't be null when imageTagMutability is set as IMMUTABLE_WITH_EXCLUSION' (Service: Ecr, Status Code: 400, Request ID: bbbeac86-14dc-4c4a-b67d-5e39b6bc804d) (SDK Attempt Count: 1)" (RequestToken: a45ab23e-8817-52f1-8f80-dc9468d8b2fd, HandlerErrorCode: GeneralServiceException)| if (filterCount === 0) { | ||
| throw new ValidationError('At least one exclusion filter must be specified when imageTagMutabilityExclusionFilters is provided.', this); | ||
| } | ||
| if (filterCount > 5) { | ||
| throw new ValidationError(`Cannot specify more than 5 exclusion filters, got ${filterCount}.`, this); | ||
| } |
There was a problem hiding this comment.
e43d952 to
3dc8eed
Compare
go-to-k
left a comment
There was a problem hiding this comment.
Thanks for your changes. Looking forward to using the feature.
|
@go-to-k Thanks always!! |
ozelalisen
left a comment
There was a problem hiding this comment.
Thank you, just have minor comments
package.json
Outdated
| "string-width": "^4.2.3" | ||
| } | ||
| }, | ||
| "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" |
There was a problem hiding this comment.
I assume this is not intended change
| ecr.ImageTagMutabilityExclusionFilter.wildcard('dev-*'), | ||
| ecr.ImageTagMutabilityExclusionFilter.wildcard('test-*'), | ||
| ecr.ImageTagMutabilityExclusionFilter.wildcard('pr-*'), | ||
| ], |
There was a problem hiding this comment.
nit: would be better to use different exclusion filters as provided in README
Pull request has been modified.
|
@ozelalisen Thank you for your review! I've resolved all of your comments. |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
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
imageTagMutabilityExclusionFiltersprop toRepositoryPropsTagMutabilityenumImageTagMutabilityExclusionFilterclassImageTagMutabilityExclusionFilterTypecurrently supports onlyWILDCARD, future additions are anticipated. Factory method-based instance creation has been implemented to ensure user convenience and future extensibility.Describe any new or updated permissions being added
None
Description of how you validated changes
Add both unit and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license