Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 3, 2025

Release notes

Improvement to logstash release artifacts file metadata: mtime is preserved when buiilding tar archives

What does this PR do?

When building tar archives, explicitly set mtime. This avoids losing that information in the minitar Writer.add_file_simple method
https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

Why is it important/What is the impact to the user?

Files containing mtime 0 lead to undesireable behavior in some use cases #17925 and do not show any clues to modification time. Avoiding setting mtime to 0 in many cases will help provide artifacts with the least amount of surprise to users.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Related issues


This is an automatic backport of pull request #18091 done by [Mergify](https://mergify.com).

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <[email protected]>

---------

Co-authored-by: João Duarte <[email protected]>
(cherry picked from commit d9b95bf)
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <[email protected]>

---------

Co-authored-by: João Duarte <[email protected]>
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @donoghuc

@donoghuc donoghuc merged commit c30c386 into 8.19 Sep 4, 2025
8 checks passed
@donoghuc donoghuc deleted the mergify/bp/8.19/pr-18091 branch September 4, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants