Repository navigation
Sort root files in withRootFiles() to keep cache hash stable - #8870
Merged
Merged
Conversation
Member
|
Makes sense, we sort file in every other search. Thanks 👍 |
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.
withRootFiles() adds the root *.php files to paths in the order Symfony Finder returns them. Finder doesn't sort, so the order is whatever the filesystem lists. On ext4 that order follows a filename hash seed per filesystem, so the same checkout can list its root files differently on another machine.
paths goes into SimpleParameterProvider::hashForCacheInvalidation(). A different order gives a different config hash, and ChangedFilesDetector then clears the whole cache. A cache restored in CI is thrown away whenever the runner's filesystem orders the root files differently.
I ran into this on GitHub Actions while two ubuntu-24.04 image versions were in rotation: every switch between them was a full run, about 150 s instead of about 30 s for roughly 1,350 files.