Skip to content

Commit

Permalink
manifest mtime reproducibility
Browse files Browse the repository at this point in the history
When building Rails assets with Nix, I found they are almost
completely reproducible. This commit fixes one of the issues. For more
information about why it is good for a build to be reproducible see:

https://reproducible-builds.org/

This stops encoding the asset compilation time (something that is not
reproducible) into the manifest.
  • Loading branch information
ryantm committed Sep 20, 2022
1 parent 1276b43 commit 0257ab7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/sprockets/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ def assets
#
# Fingerprint path (String):
# logical_path: Logical path (String)
# mtime: ISO8601 mtime (String)
# mtime: ISO8601 mtime (String) always "1970-01-01T00:00:01+00:00"
# digest: Base64 hex digest (String)
#
# { "application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js" =>
# { 'logical_path' => "application.js",
# 'mtime' => "2011-12-13T21:47:08-06:00",
# 'mtime' => "1970-01-01T00:00:01+00:00",
# 'digest' => "2e8e9a7c6b0aafa0c9bdeec90ea30213" } }
#
def files
Expand Down Expand Up @@ -172,7 +172,7 @@ def compile(*args)
end

assets_to_export.each do |asset|
mtime = Time.now.iso8601
mtime = Time.at(1).utc.to_datetime.iso8601 # for reproducibility
files[asset.digest_path] = {
'logical_path' => asset.logical_path,
'mtime' => mtime,
Expand Down

0 comments on commit 0257ab7

Please sign in to comment.