apache / apache/burr

ci: reproducible builds with SOURCE_DATE_EPOCH

Open
#716 3 comments 0 reactions 0 assignees View on GitHub
area/ci kind/improvement priority/high
Dominant language
Python
Stars
2.5k
Forks
195
Avg merge
6d 10h
Merged PRs (30d)
17

Description

Part of #715

### Problem

Our build artifacts are not reproducible. Building the same source twice may produce different checksums due to timestamps embedded in the tarball/wheel metadata. This makes voter verification harder and prevents bit-for-bit comparison of locally rebuilt packages against the RC artifacts.

### Solution

Set `SOURCE_DATE_EPOCH` to the timestamp of the tagged commit before building. This ensures all file timestamps inside the archive are deterministic.

Airflow does this in their release tooling and it allows voters to rebuild from source and binary-compare against the SVN artifacts.

### Implementation

- In `scripts/apache_release.py`, before calling `hatch build` or `python -m build`:
```python
import subprocess
epoch = subprocess.check_output(["git", "log", "-1", "--format=%ct", tag]).strip()
os.environ["SOURCE_DATE_EPOCH"] = epoch.decode()
```
- Document in `scripts/README.md` that builds are reproducible
- Add a test that rebuilds from a tagged commit and compares checksums

### References

- [Python reproducible builds](https://reproducible-builds.org/docs/source-date-epoch/)
- [PEP 552](https://peps.python.org/pep-0552/) (deterministic .pyc)
- Airflow's implementation in `breeze release-management prepare-airflow-distributions`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.