Add KEEP_ALL_WHEELS flag

The patch adds KEEP_ALL_WHEELS set to False by default.
The flag allows to do not remove wheels after built of
requirement image. This is useful where reproducibility
of builds with the same WHEEL image is needed as will allow
to keep 3rd party libs (not specified in upper-constraints.txt)
file with same versions.

Change-Id: I00fd3df2ba46072b3f19c9d08f69bb3c1f53d01f
This commit is contained in:
Vasyl Saienko 2019-10-11 06:41:47 +00:00 committed by Andrii Ostapenko
parent 938a110f30
commit 75bba38822
3 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,7 @@ ARG EXTRA_BINDEP=""
ARG EXTRA_PYDEP=""
ARG REGISTRY_PROTOCOL="detect"
ARG REGISTRY_INSECURE="False"
ARG KEEP_ALL_WHEELS="False"
ARG UID=42424
ARG GID=42424

View File

@ -113,6 +113,9 @@ For more advanced building you can use docker build arguments to define:
The only caveat is these packages must exist in WHEELS form. So if
you wanted to include rpdb, you would need to have built that into your
WHEELS.
* `KEEP_ALL_WHEELS` Set this to `True` if you want to keep all packages, even
not built ourselfs in the WHEEL image. Is useful for reproducible builts,
as 3rd party libraries will be keept in WHEEL image.
* `PIP_ARGS` Specify additional pip parameters you would like.
* `PIP_WHEEL_ARGS` Specify additional pip wheel parameters you would like.
Default is PIP_ARGS.

View File

@ -80,9 +80,11 @@ if [[ -f /failure ]]; then
exit 1
fi
# Remove native-binary wheels, we only want to keep wheels that we
# compiled ourselves.
awk -F'[ ,]+' '/^Skipping/ {gsub("-","_");print $2}' /tmp/wheels.txt | xargs -r -n1 bash -c 'ls /$1-*' _ | sort -u | xargs -t -r rm
if [[ KEEP_ALL_WHEELS == "False" ]]; then
# Remove native-binary wheels, we only want to keep wheels that we
# compiled ourselves.
awk -F'[ ,]+' '/^Skipping/ {gsub("-","_");print $2}' /tmp/wheels.txt | xargs -r -n1 bash -c 'ls /$1-*' _ | sort -u | xargs -t -r rm
fi
# Purge all files that are not wheels or txt to reduce the size of the
# layer to only what is needed