-
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
fix(servicecatalog): avoid asset hash change for latest version in ProductStackHistory #32248
base: main
Are you sure you want to change the base?
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. 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.
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
Issue # (if applicable)
Closes #24561.
Reason for this change
If you use ProductStackHistory to manage the historic versions of your product and add a new version to it, the latest version (before adding the new one) changes because the asset hash computed for the product template changes. This happens because the asset hash for the current version and historic versions is computed in a different way.
Description of changes
I changed the code to make sure that the asset hash for a product template is computed the same way, no matter if derived directly from a ProductStack instance (as is the case for the current version) or read from a snapshot. For the current version, the code used to synthesize the template in memory and hash the string, before writing the template to disk. I changed the order, writing the template to disk and then use FileSystem.fingerprint on the file - which is exactly what is used for snapshot versions.
This way, the asset hashes of historic version of existing products based ProductStack won't change as the code changes affects only the current version.
Description of how you validated changes
I've added a unit test to cover this particular scenario. However, I wasn't able to update the integration tests. I tried but no matter what I did I always got the following error message although I configured the credentials for my account and bootstrapped it correctly. It's my first contribution, so I may have missed something obvious.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license