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

Use plain Debian images in CI #372

Merged
merged 3 commits into from
Aug 31, 2022
Merged

Use plain Debian images in CI #372

merged 3 commits into from
Aug 31, 2022

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Aug 25, 2022

I wrote detailed commit messages for these, so please read those. In summary:

  • Document why build-sync-wheels can't be run as root
  • Switch to plain Debian images. Fix the reprotest-wheels job so it runs as a non-root user
  • Switch lint-and-test and reprotest-debs over to bullseye.

.circleci/config.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@gonzalo-bulnes gonzalo-bulnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no blockers. Only left a couple of comments for my own understanding and slight preferences.

.circleci/config.yml Show resolved Hide resolved
scripts/build-sync-wheels Outdated Show resolved Hide resolved
Currently running build-sync-wheels as root will cause issues for
different, subtle reasons.

First, you can't unpack idna-3.2.tar.gz as root with tar. For some
reason it uses very large uids/gids. When tar is run as root, it tries
to restore the original file owners, which doesn't work because those
large uids/gids are bigger than an unsigned 32-bit integer.

Note that repacking the upstream tarball isn't an option because we are
testing reproducibility against the source tarball hosted on PyPI. I've
asked upstream if they can fix this going forward at
<kjd/idna#123>.

The workaround for tar is to use `--no-same-owner`, so the files will
end up owned by the current user, aka root:root. This allows unpacking
to succeed, but for some reason, it causes very subtle reproducibility
differences in the built Python wheels. I've posted diffoscope output to
<https://gist.github.com/legoktm/d8a9209dbf94bb3a8939828a609fd2c4>,
various metadata files have the group writable bit set when previously
it wasn't.

Theoretically we could rebuild all of our wheels to be in this
configuration, except that's a lot of unnecessary work and it would
likely mean that everyone has to build wheels as root going forward.
That's risky unless you're properly using rootless containers, so it's
easiest to just tell people they need to run this script as a non-root
user.
For the most part this is a very straightforward switch, except for the
reprotest-wheels job.

As noted in the previous commit, we cannot run the build-sync-wheels
script as root (which the Debian images default to). We add a "ci" user,
chown the repository for them, and then run the test command. One subtle
catch is that the repository needs to be checked out in a place other
than /root, so we set the working_directory to /srv.

I also noticed that we were installing all of the 5GB of diffoscope
dependencies without actually ever using diffoscope (and if we were
using diffoscope, we don't need extra utilities to diff debs and
wheels), so using `--no-install-recommends` shaves off about 3 minutes
of runtime. We do need to manually install faketime since it's only a
recommends, but that seems like a fair tradeoff.

And we can now delete the custom `packaging-debian-{buster,bullseye}`
images we were maintaining!
@legoktm legoktm force-pushed the plain-debian-images branch from 9727077 to 29ccbe0 Compare August 30, 2022 03:38
Copy link
Contributor

@gonzalo-bulnes gonzalo-bulnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the explanations @legoktm (and @eloquence). I'm shipping this.

@gonzalo-bulnes gonzalo-bulnes merged commit d1adbde into main Aug 31, 2022
@gonzalo-bulnes gonzalo-bulnes deleted the plain-debian-images branch August 31, 2022 00:39
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

Successfully merging this pull request may close these issues.

3 participants