fix(ecs): support digest references in TagParameterContainerImage via imageDigest option#37868
fix(ecs): support digest references in TagParameterContainerImage via imageDigest option#37868Zelys-DFKH wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
The pull request linter fails with the following errors:
❌ Fixes must contain a change to an integration test file and the resulting snapshot.
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
✅ A exemption request has been requested. Please wait for a maintainer's review.
|
Exemption Request The linter is right to flag this: integration tests catch gaps unit tests miss. This isn't one of those cases. Per AGENTS.md, integration tests are required for new CFN resource types, new CFN properties, and custom resources. This PR adds none of those. Two unit tests assert the synthesized template produces the correct separator for each case. That's the exact coverage an integration test would also verify, without deploying anything new to CloudFormation. |
Closes #37718.
Credit to @nguyengg for filing this with a clear diagnosis, and to @pahud for the key insight that
repositoryUriForTagOrDigest()can't be used here becauseCfnParameter.valueAsStringis an unresolved CloudFormation token at synth time — thestartsWith('sha256:')check always fails.Reason for this change
TagParameterContainerImage.bind()always callsrepositoryUriForTag(), which produces a colon separator between the repository URI and the parameter value. When the parameter holds a digest (sha256:...), the correct separator is@. The naive fix of switching torepositoryUriForTagOrDigest()doesn't work because that method resolves the tag/digest at synth time usingstartsWith('sha256:'), butCfnParameter.valueAsStringis an unresolved token — so it always falls through to the tag path.Description of changes
Adds an optional
imageDigest?: booleanprop toTagParameterContainerImage(default:false, fully backward-compatible). Whentrue,bind()callsrepositoryUriForDigest()instead ofrepositoryUriForTag(), producing the correct@separator in the synthesized CloudFormation template. Also updates the JSDoc fortagParameterNameandtagParameterValueto reflect that the parameter may hold a digest as well as a tag.Describe any new or updated permissions being added
None.
Description of how you validated changes
Two new unit tests in
tag-parameter-container-image.test.ts:imageDigest: false/ omitted): asserts the synthesizedImageproperty uses:separatorimageDigest: true: asserts the synthesizedImageproperty uses@separatorAll existing tests continue to pass.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license