Add SOURCE_DATE_EPOCH support for reproducible builds#1537
Open
tonobo wants to merge 1 commit intoaptly-dev:masterfrom
Open
Add SOURCE_DATE_EPOCH support for reproducible builds#1537tonobo wants to merge 1 commit intoaptly-dev:masterfrom
tonobo wants to merge 1 commit intoaptly-dev:masterfrom
Conversation
Implement support for the SOURCE_DATE_EPOCH environment variable as specified by reproducible-builds.org. When set, this variable overrides the current timestamp in the Release file's Date and Valid-Until fields, enabling reproducible filesystem publishes. - Read SOURCE_DATE_EPOCH environment variable in Publish() - Use the epoch timestamp for both Date and Valid-Until fields - Gracefully fallback to current time if unset or invalid - Add comprehensive tests for valid and invalid SOURCE_DATE_EPOCH values
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1537 +/- ##
==========================================
- Coverage 76.96% 76.64% -0.32%
==========================================
Files 160 160
Lines 14754 14757 +3
==========================================
- Hits 11355 11311 -44
- Misses 2266 2317 +51
+ Partials 1133 1129 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
@neolynx Can you please have a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Reproducible builds ensure that building the same source input always produces byte-identical output, regardless of when or where the build happens. This is important for security and trust: anyone can independently verify that published binaries actually correspond to their source code, with no tampering or hidden modifications.
When aptly publishes a repository to the filesystem, the Release file includes a Date field set to the current time. This means publishing the same packages twice produces different output, breaking reproducibility. By honoring SOURCE_DATE_EPOCH (a Unix timestamp typically derived from the last source change), the Date and Valid-Until fields become deterministic, making the entire published repository output byte-identical across runs with the same input.
This follows the https://reproducible-builds.org/specs/source-date-epoch/ specification, which is widely adopted across the Debian ecosystem and other projects.
Checklist
AUTHORS