Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rakelib/artifacts.rake
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ namespace "artifact" do
elsif stat.symlink?
tar.symlink(path_in_tar, File.readlink(path), :mode => stat.mode)
else
tar.add_file_simple(path_in_tar, :mode => stat.mode, :size => stat.size) do |io|
tar.add_file_simple(path_in_tar, :mode => stat.mode, :size => stat.size, :mtime => stat.mtime&.to_i || 0) do |io|
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reviewer here is the source for this method https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L104-L177

Idea is that to avoid it defaulting to nil (and resulting in a 0 for linux epoch time) we explicitly pass through the mtime of the file on the builder (or 0 if for some reason that cant be computed).

One use case #17925 on upgrade is relying on rsync defaults where it would be convenient that for each logstash release all files in an artifact have a "newer" mtime than the previous release. I believe this would ensure that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we then just do :mtime => stat.mtime&.to_i || Time.now.to_i ? seems better than epoch, there's already some expectation that dates of files in the archive will be similar to the date of when the files were put into the archive.

File.open(path, 'rb') do |fd|
chunk = nil
size = 0
Expand Down