Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that make build-wheels builds wheels reproducibly where possible #196

Closed
eloquence opened this issue Sep 9, 2020 · 6 comments
Closed
Assignees

Comments

@eloquence
Copy link
Member

eloquence commented Sep 9, 2020

Currently, the make build-wheels target and the underlying scripts/build-sync-wheels script does not set SOURCE_DATE_EPOCH or specify a build directory. As a result, it does not create reproducible wheels, which is an important requirement for further build automation.

We should ensure that this target builds wheels reproducibly whenever possible without further modification.

@eloquence
Copy link
Member Author

eloquence commented Sep 9, 2020

@redshiftzero currently maintains https://reproduciblewheels.com/ as a useful index of Python projects which can be built as wheels reproducibly (including the wheels from https://pypi.securedrop.org/simple/), with updates to https://github.com/redshiftzero/reproduciblewheels/blob/main/site_data.json being pushed daily via bot. For further comparability, it may be desirable to specify the same build parameters as used for that project. Quote:

To compare your wheel hashes with the hashes of these packages, SOURCE_DATE_EPOCH should be set to 1596163658 and you should pass the --build /tmp/buildwheel option to pip at build time.

@eloquence
Copy link
Member Author

We discussed today that it might be nice to standardize on the timestamp of Aaron's first SD commit. Per git show -s 62bbe590afd77a6af2dcaed46c93da6e0cf40951 --date=unix in securedrop repo that would be 1309379017.

@emkll
Copy link
Contributor

emkll commented Nov 16, 2020

As part of this task, we should add a CI reproducibility check, to ensure changes to the wheel building command are correct.

@conorsch conorsch self-assigned this Nov 24, 2020
@conorsch
Copy link
Contributor

Took a look at this today. Used the excellent diffoscope & reprotest tools to examine what was different about the wheels, specifically for the securedrop-client package build. In short, we had the same blockers as already surfaced in https://github.com/redshiftzero/reproduciblewheels:

  1. SOURCE_DATE_EPOCH must be set
  2. a constant build dir path must be used

Also added a umask of 022 (sane default) to satisfy some other reproducibility checks automatically run by reprotest. In fact, out of all the checks that reprotest provides, our wheels fail only on the time check, because messing with system time breaks HTTPS, so the fetches fail.

When using reprotest, however, the platform for two dependencies of securedrop-client gets improperly set as i686, rather than x86_64: sqlalchemy & markupsafe. We can force a platform via --build-option --plat-name=<foo> but we don't want to do that for the non-platform specific packages, as well. Will have a think on what's our best bet there, but for now it appears to be a side-effect of using reprotest—platform is properly inferred when I run the build-sync-wheels script locally.

So, next steps are:

  1. testing with more packages than just securedrop-client, to confirm the results are consistent across the board;
  2. figuring out why reprotest sets i686 for platform (optional)
  3. updating CI/tests to verify the wheels reproducibility

@eloquence
Copy link
Member Author

It looks to me like this issue is fully resolved, as originally scoped, by #211 (which does add a reproducibility check to CI as well, see https://app.circleci.com/pipelines/github/freedomofpress/securedrop-debian-packaging/834/workflows/cee208e3-34c8-4f65-b8d5-be75bf34c200/jobs/6446), am I missing something or can we close? Any additional work should ideally be scoped into follow-up issues, IMO.

@conorsch
Copy link
Contributor

conorsch commented Jan 5, 2021

Agreed! We still have #213 outstanding, which will start using the reproducibly-built wheels, but that's nicely tracked in #212 already.

@conorsch conorsch closed this as completed Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants