-
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
feat(ecr-assets): expose property imageTag separately from imageUri in ECR assets #21582
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the name synthesized
Tag. What about imageTag
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a public facing field or something that we use in our internal logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public facing field. I changed it to imageTag
everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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). |
…n ECR assets (aws#21582) ECR assets has properties `imageUri` and `assetHash`. `assetHash` is used to generate the image tag, and `imageUri` is the repository and tag concatenated. However, parsing the tag from the URI is not possible since `imageUri` is a token. Additionally, `assetHash` and the image tag are not always identical since adding a synthesizer to the stack with a `dockerTagPrefix` would concatenate the prefix to the hash to make the tag. It is now possible to get the tag by itself with `synthesizedTag`. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
ECR assets has properties
imageUri
andassetHash
.assetHash
is used to generate the image tag, andimageUri
is the repository and tag concatenated. However, parsing the tag from the URI is not possible sinceimageUri
is a token. Additionally,assetHash
and the image tag are not always identical since adding a synthesizer to the stack with adockerTagPrefix
would 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 integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license