The BuildContextHasher forwards the list of mapping values to the FileDirectoryListHasher which then uses the file paths as input for calculating the Hash value. If the files of the mapping are stored in volatile directories (for example temporary directories), the hash value will change for each execution of the (respective) docker build task. This is a problem when the build content needs to be copied to a temporary directory, or if the user uses absolute paths as arguments (in case of the flavor path of exaslct for example).
Solution
In order to fix this the FileDirectoryListHasher needs to get the list of mappings as input. It will then use the relative paths, stored as keys in the mappings, as input for the hasher; and use the real file system paths (values) only to read the file content, as input for the hasher.
RCA
The BuildContextHasher forwards the list of mapping values to the FileDirectoryListHasher which then uses the file paths as input for calculating the Hash value. If the files of the mapping are stored in volatile directories (for example temporary directories), the hash value will change for each execution of the (respective) docker build task. This is a problem when the build content needs to be copied to a temporary directory, or if the user uses absolute paths as arguments (in case of the flavor path of exaslct for example).
Solution
In order to fix this the FileDirectoryListHasher needs to get the list of mappings as input. It will then use the relative paths, stored as keys in the mappings, as input for the hasher; and use the real file system paths (values) only to read the file content, as input for the hasher.