fix: Filter the directories/files hashed when using commands with patterns, docs and examples fixes #720
+91
−66
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.
Description
This set of changes does the following:
os.path.normpathto normalize other paths used as input to the prepare steppackage.pyjsencode, when passed from Terraform to pythonMotivation and Context
When commands and patterns are used together, the patterns filter is applied when building the archive, but not during the prepare step. Files that are not included in the archive due to the filter are still hashed. If some of those files are generated, with their content depending on the build environment, then, even if the built archives are the same across different build environments, the calculated hashes are not the same and the module wants to create again the archive and redeploy. Making the hashing step take into account the patterns filter fixes #672.
Hashing again the content of
package.pyrestores the logic that was necessary to disable in #66 to fix #63. This time only the content ofpackage.pyis hashed, without its path.The change to normalize other paths used as input with
os.path.normpathis for consistency with existing normalization on some input paths.Breaking Changes
None, but all the hashes will change due to inclusion of
package.pyinto the hashing.How Has This Been Tested?
examples/*to demonstrate and validate my change(s)examples/*projectspre-commit run -aon my pull request