-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambda.DockerImageCode.fromEcr: imageTagOrDigest field cannot recognize digests supplied as CfnParameter #31860
Comments
I think it's because repositoryUriForTagOrDigest() is not handling unresolved tokens well.
Specifically this func aws-cdk/packages/aws-cdk-lib/aws-ecr/lib/repository.ts Lines 226 to 232 in d1d179f
Making this a p1 and we probably need a PR to better handle unresolved tokens. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
…aws#32053) ### Issue # (if applicable) Closes aws#31860. ### Reason for this change Currently customers can pass one property `tagOrDigest` and if the customers pass a CFN parameter, CDK could not know if it is a tag or digest, and so the generated URI is not correct. Now the same parameter can supports Tokens, and it will generate a CFN condition to check if the value of this token is digest or tag, and then update the uri based on the condition output. ### Description of changes Check if the input is a Token, and so instead of determining if its value is a tag or digest in synth time, we create a CFN condition to do this check in CFN, and then determine how to build the repo uri. ### Description of how you validated changes Added unit test cases, and integration test cases with assertions. ### 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*
Describe the bug
Since imageTagOrDigest supplied in the props for lambda.DockerImageCode.fromEcr can contain either an image tag or digest, if the value isn't explicitly known (in my example it's a CfnParameter) it defaults to it being a tag. There appears to be no workaround for this at the moment
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The following cloudformation code should be produced
Current Behavior
The following code is produced. Notice the
:
splitting the image tagReproduction Steps
The following code produces an ECR URI with a
:
separating the image digest from the URL instead of an@
. This causes a deployment failure in cloudformation due to a validation error on the lambda sidePossible Solution
Partition the imageTagOrDigest field into two separate fields or add a type tag
Additional Information/Context
No response
CDK CLI Version
2.162.1
Framework Version
No response
Node.js Version
v22.4.1
OS
MacOS 14.6.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: