feat(ecr-assets): expose property imageTag separately from imageUri in ECR assets #21582
feat(ecr-assets): expose property imageTag separately from imageUri in ECR assets #21582mergify[bot] merged 12 commits intoaws:mainfrom
Conversation
| /** | ||
| * The tag of this asset when it is uploaded to ECR. The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix. | ||
| */ | ||
| public readonly synthesizedTag: string; |
There was a problem hiding this comment.
I'm not sure about the name synthesizedTag. What about imageTag instead?
There was a problem hiding this comment.
I chose synthesizedTag to make it clear that this will differ from assetHash when a synthesizer adds a dockerTagPrefix. I was also worried that a user would see imageUri and imageTag and think that they are distinct instead of knowing imageUri includes the tag (I have done this in my project).
If you feel those concerns are relatively minor, I am fine with imageTag.
There was a problem hiding this comment.
Is this a public facing field or something that we use in our internal logic?
There was a problem hiding this comment.
This is a public facing field. I changed it to imageTag everywhere.
There was a problem hiding this comment.
imageTag is good. The relationship between uri and tag is docker domain knowledge. I don't think it would be a good idea to abstract that away.
packages/@aws-cdk/core/lib/assets.ts
Outdated
|
|
||
| /** | ||
| * The tag of the image in Amazon ECR. | ||
| * @default ${dockerTagPrefix}${asset.sourceHash} |
There was a problem hiding this comment.
| * @default ${dockerTagPrefix}${asset.sourceHash} | |
| * @default `${dockerTagPrefix}${asset.sourceHash}` |
does this work? It seems weird to not have the backticks on the default
There was a problem hiding this comment.
I did not want the docs to actually parse the values, just show that it is the two concatenated. There may be a better way to represent that.
There was a problem hiding this comment.
This needs to be documentation that makes sense for other languages. This convention is specific to TypeScript/JavaScript and may not translate properly. This should be descriptive of what the default will be, not a code snippet.
There was a problem hiding this comment.
I changed it to
@default - dockerTagPrefix + asset.sourceHash
I can be more descriptive, say "dockerTagPrefix concatenated with the sourceHash of the asset", but I think the + conveys string concatenation agnostically
Co-authored-by: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com>
Pull request has been modified.
|
Reason for the integ-test exemption: this feature does not change behavior or the CFN template. The The unit tests should cover what an integ-test would. |
| /** | ||
| * The tag of this asset when it is uploaded to ECR. The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix. | ||
| */ | ||
| public readonly synthesizedTag: string; |
There was a problem hiding this comment.
Is this a public facing field or something that we use in our internal logic?
packages/@aws-cdk/core/lib/assets.ts
Outdated
|
|
||
| /** | ||
| * The tag of the image in Amazon ECR. | ||
| * @default ${dockerTagPrefix}${asset.sourceHash} |
There was a problem hiding this comment.
This needs to be documentation that makes sense for other languages. This convention is specific to TypeScript/JavaScript and may not translate properly. This should be descriptive of what the default will be, not a code snippet.
Pull request has been modified.
|
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). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
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). |
ECR assets has properties
imageUriandassetHash.assetHashis used to generate the image tag, andimageUriis the repository and tag concatenated. However, parsing the tag from the URI is not possible sinceimageUriis a token. Additionally,assetHashand the image tag are not always identical since adding a synthesizer to the stack with adockerTagPrefixwould concatenate the prefix to the hash to make the tag.It is now possible to get the tag by itself with
synthesizedTag.All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license