Skip to content

Conversation

@badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Aug 15, 2025

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

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

@aws-cdk-automation aws-cdk-automation requested a review from a team August 15, 2025 15:03
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Aug 15, 2025
@badmintoncryer badmintoncryer changed the title feat: image tag mutability exclusion filters feat(ecr): image tag mutability exclusion filters Aug 15, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@badmintoncryer badmintoncryer marked this pull request as ready for review August 16, 2025 06:27
@aws-cdk-automation aws-cdk-automation dismissed their stale review August 16, 2025 06:28

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

const hasExclusionFilters = !!exclusionFilters;

if (hasExclusionFilters && !requiresExclusion) {
if (!tagMutability) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)

Comment on lines 932 to 937
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);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Thanks for your changes. Looking forward to using the feature.

@badmintoncryer
Copy link
Contributor Author

@go-to-k Thanks always!!

@badmintoncryer badmintoncryer changed the title feat(ecr): image tag mutability exclusion filters feat(ecr): support for image tag mutability exclusion filters Sep 26, 2025
@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Sep 26, 2025
@badmintoncryer badmintoncryer changed the title feat(ecr): support for image tag mutability exclusion filters feat(ecr): image tag mutability exclusion filters Sep 26, 2025
@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Sep 26, 2025
@ozelalisen ozelalisen self-assigned this Oct 20, 2025
Copy link
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

Thank you, just have minor comments

package.json Outdated
"string-width": "^4.2.3"
}
},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is not intended change

Comment on lines 22 to 25
ecr.ImageTagMutabilityExclusionFilter.wildcard('dev-*'),
ecr.ImageTagMutabilityExclusionFilter.wildcard('test-*'),
ecr.ImageTagMutabilityExclusionFilter.wildcard('pr-*'),
],
Copy link
Member

Choose a reason for hiding this comment

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

nit: would be better to use different exclusion filters as provided in README

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Oct 21, 2025
@mergify mergify bot dismissed ozelalisen’s stale review October 21, 2025 15:23

Pull request has been modified.

@badmintoncryer
Copy link
Contributor Author

@ozelalisen Thank you for your review! I've resolved all of your comments.

@mergify
Copy link
Contributor

mergify bot commented Oct 22, 2025

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).

@mergify mergify bot added the queued label Oct 22, 2025
@mergify
Copy link
Contributor

mergify bot commented Oct 22, 2025

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).

@mergify mergify bot merged commit f6dd5cf into aws:main Oct 22, 2025
19 of 20 checks passed
@mergify mergify bot removed the queued label Oct 22, 2025
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2025
@badmintoncryer badmintoncryer deleted the image-tag-mutability branch October 23, 2025 00:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-ecr: Support for exceptions to tag immutability

4 participants