fix(servicecatalog): avoid asset hash change for latest version in Pr… - #38608
Open
1001R wants to merge 2 commits into
Open
fix(servicecatalog): avoid asset hash change for latest version in Pr…#386081001R wants to merge 2 commits into
1001R wants to merge 2 commits into
Conversation
Collaborator
|
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. |
1 similar comment
Collaborator
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #24561
Closes #24561.
Reason for this change
When you use ProductStackHistory to handle the previous versions of your product and add a new version, the most recent version (prior to adding the new one) is altered because the asset hash calculated for the product template changes. This occurs because the asset hash for the current version and the historic versions is calculated differently.
Description of changes
I modified the code to ensure that the asset hash for a product template is calculated consistently, whether it comes directly from a ProductStack instance (as it does in the current version) or is retrieved from a snapshot. Previously, for the current version, the code generated the template in memory and hashed the string before saving the template to disk. I reversed this process, now saving the template to disk first and then applying FileSystem.fingerprint to the file—this matches the method used for snapshot versions.
This approach ensures that the asset hashes of historical versions of existing products based on ProductStack remain unchanged, since the code changes only impact the current version.
Describe any new or updated permissions being added
No additional permissions have been introduced, and none of the current ones have been modified.
Description of how you validated changes
I've added a unit test to cover this particular scenario.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license