Page MenuHomePhabricator

The python-build images regenerate wheels even when matching ones are already available
Closed, ResolvedPublic

Description

When the deploy repository only has the artifacts.tar.gz, all wheels are build from scratch. When changing a single requirements, other unrelated wheels are modified when their build is not reproducible.

When the deploy repository has wheels committed in, a version bump would result in a second wheel for the same requirement. One can possibly delete the existing wheels but ends up with the same issue as above.

The python-build images have a script which takes a list of requirements (/deploy/frozen-requirements.txt), run pip wheel with resulting wheels written to /wheels. The images do not have an ability to be passed previously build wheels to skip building them.

The logic is in operations/docker-images/production-images.git images/python-build/run.sh

Event Timeline

Change 605653 had a related patch set uploaded (by Hashar; owner: Hashar):
[operations/docker-images/production-images@master] python-build: allow reuse of existing wheels

https://gerrit.wikimedia.org/r/605653

fgiunchedi triaged this task as Medium priority.Aug 17 2020, 8:32 AM

Change 605653 abandoned by Hashar:
[operations/docker-images/production-images@master] python-build: reuse previously built wheels

Reason:
Will revive / redo if I ever had to rebuild wheels for Zuul

https://gerrit.wikimedia.org/r/605653

Will revive / redo if I ever had to rebuild wheels for Zuul

Change 605653 restored by Hashar:

[operations/docker-images/production-images@master] python-build: reuse previously built wheels

https://gerrit.wikimedia.org/r/605653

thcipriani lowered the priority of this task from Medium to Low.
thcipriani subscribed.

@hashar is this waiting on review, or are you making changes to your patch?

Change 605653 abandoned by Hashar:

[operations/docker-images/production-images@master] python-build: reuse previously built wheels

Reason:

I have reopened this while pairing with Clément to update docker-pkg. We eventually found out that most dependencies on Pypi have wheels published which are downloaded directly. So it is probably less of a problem nowadays (short of redownloading wheels each time).

https://gerrit.wikimedia.org/r/605653

Most dependencies on Pypi now provides wheels and our build download them. It is not really optimal but it is good enough. Maybe I will revisit this again later if I need it, meanwhile I am declining the task.

To upgrade the OS on CI servers BusterBullseye (T334517) I have the use case of polishing up the Zuul deployment Makefile. I revisited the previous Gerrit changes I have opened and eventually figured out a system based on using PIP_FIND_LINKS to reuse previous build artifacts.

Change 606242 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/zuul/deploy@master] Reuse previous artifacts as a wheel cache

https://gerrit.wikimedia.org/r/606242

Change 606242 merged by jenkins-bot:

[integration/zuul/deploy@master] Reuse previous artifacts as a wheel cache

https://gerrit.wikimedia.org/r/606242

Change 998932 had a related patch set uploaded (by Hashar; author: Hashar):

[All-Projects@refs/meta/config] Add LFS config for integration/zuul/deploy

https://gerrit.wikimedia.org/r/998932

Change 998932 merged by Hashar:

[All-Projects@refs/meta/config] Add LFS config for integration/zuul/deploy

https://gerrit.wikimedia.org/r/998932

Change 998933 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/zuul/deploy@master] Track wheels individually

https://gerrit.wikimedia.org/r/998933

Change 1002997 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/docker-images/production-images@master] python-build: default to run as nobody from /deploy

https://gerrit.wikimedia.org/r/1002997

Change 1003002 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/docker-images/production-images@master] python-build: add make and virtualenv

https://gerrit.wikimedia.org/r/1003002

Change 940157 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/docker-images/production-images@master] python-build: set date of source files in the wheels

https://gerrit.wikimedia.org/r/940157

Change 940157 merged by Clément Goubert:

[operations/docker-images/production-images@master] python-build: set date of source files in the wheels

https://gerrit.wikimedia.org/r/940157

Change 998933 merged by jenkins-bot:

[integration/zuul/deploy@master] Track wheels individually

https://gerrit.wikimedia.org/r/998933

That has been solved by setting PIP_FIND_LINKS to point to the directory holding the existing wheels. I also wanted the wheels to be more or less reproducible which got done by setting SOURCE_DATE_EPOCH (Change 940157).

Ideally those tricks should be "upstreamed" from the integration/zuul/deploy toward the python-build images. Possibly by having the build image to generate the Makefile in addition of the wheels.