Change rm to use find to avoid deleting cache directory during snapshot cleanup#10756
Conversation
| $(STATUS_FLAGS_DIR)/imagegen_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME) | ||
| @echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache" | ||
| rm -rf $(local_and_external_rpm_cache) | ||
| find $(local_and_external_rpm_cache) -type f -name '*.rpm' -exec rm -f {} + |
There was a problem hiding this comment.
FYI find already has a -delete action, so you should be able to shorten this a bit. Also, just to be safe, it's good to surround paths with quotes in case there are any spaces in the path:
| find $(local_and_external_rpm_cache) -type f -name '*.rpm' -exec rm -f {} + | |
| find "$(local_and_external_rpm_cache)" -type f -name '*.rpm' -delete |
| $(STATUS_FLAGS_DIR)/build_packages_cache_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME) | ||
| @echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache" | ||
| rm -rf $(remote_rpms_cache_dir) | ||
| find "$(remote_rpms_cache_dir)" -type f -name '*.rpm' -delete |
There was a problem hiding this comment.
I am wondering why are using the fasttrack/3.0 branch for this change instead of 3.0-dev ?
/cc @PawelWMS
There was a problem hiding this comment.
@mfrw we are putting this to fasttrack since it is a bug which blocks the build (fasttrack is using the precacher which is what discovered this build break). As a result, we will put this to fasttrack to unblock then cherry pick to 3.0-dev to follow the normal fasttrack procedure.
|
Auto cherry-pick results: Auto cherry-pick pipeline run -> https://dev.azure.com/mariner-org/mariner/_build/results?buildId=659301&view=results |
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./LICENSES-AND-NOTICES/SPECS/data/licenses.json,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
What does the PR accomplish, why was it needed?
When using the precacher, the cache directory can be removed after creation causing a file not found, breaking the build. Rather than removing the folder, we will instead delete all of the rpms contained within.
Change Log
Does this affect the toolchain?
NO
Test Methodology