Asset.fingerprint() does not account for file mode, only file type and content
See original GitHub issueWhen adding files to an Asset staging area a hash is calculated that attempts to verify that the files have actually changed in order to avoid unneeded rebuilds. However, the fingerprint() function that calculates this hash only takes into account the type of the file (file or folder) and its content.
It does not take into account the Unix file mode. So if you change the mode of a file the asset system will not detect a change and will not rebuild the asset.
Reproduction Steps
I created a Dockerfile that executes a bash script. Initially forgot to chmod +x
the script file, so it was not executable. I built the asset with CDK, which built the Docker image and pushed it.
Once I realize the error of my ways and the Docker image failed to run in my dev environment I went back and ran chmod +x
on the bash script file so that it could actually be executed.
I did a CDK build again and noted that CDK skipped the asset build because it did not notice any changes. Despite the file mode change CDK continued to use the previous version of the Docker image without picking up my changes. I had to make another file change by adding a comment before CDK noticed a change and rebuilt the asset
Environment
- CLI Version : 1.22.0
- Framework Version: 1.22.0
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Bad bot.
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.