Skip to content

Feature: TarFileWriter tool optionally preserves input file mtimes #149

@dannysullivan

Description

@dannysullivan

See bazelbuild/bazel#11028 for initial conversation.

I work on a team that maintains deployment tools that use https://github.com/bazelbuild/rules_docker/ to build docker images for applications. We noticed that static files in deployed applications always had a Last-Modified value of the unix epoch. We traced the issue back to the TarFileWriter class, which copies all input files into an output tar and preserves most file metadata but overrides the mtime to a provided value (defaulting to 0).

I understand why, in many cases, users would want predictable mtimes for build reproducibility. I'm not sure I understand why this tool should always override mtimes, instead of making that an opt-in or opt-out feature. In our use case, we're passing an entire tar file through TarFileWriter as an input - I think it would be reasonable to allow the output metadata to match the input metadata.

Metadata

Metadata

Assignees

Labels

P2An issue that should be worked on when time is available

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions