Rename PIP_VERSION to AIRFLOW_PIP_VERSION (#13320)

Some older versions of PIP (including the one in dockerhub!) treat
all env variables starting with PIP_ as a way to pass
options. Setting PIP_VERSION to 20.2.4 and exporting it causes
error "ValueError: invalid truth value '20.2.4'" because it
does not have --version option and it treats it as --verbose

¯\_(ツ)_/¯

You can read more about it here:

https://github.com/pypa/pip/issues/4528

This PR renames the variable to avoid this side effect.

(cherry picked from commit 8fed541192)
This commit is contained in:
Jarek Potiuk 2020-12-26 17:01:01 +01:00 коммит произвёл Kaxil Naik
Родитель 025793c50b
Коммит dc843192e6
5 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -47,7 +47,7 @@ ARG CASS_DRIVER_BUILD_CONCURRENCY="8"
ARG PYTHON_BASE_IMAGE="python:3.6-slim-buster"
ARG PYTHON_MAJOR_MINOR_VERSION="3.6"
ARG PIP_VERSION=20.2.4
ARG AIRFLOW_PIP_VERSION=20.2.4
##############################################################################################
# This is the build image where we build all dependencies
@ -61,8 +61,8 @@ ENV PYTHON_BASE_IMAGE=${PYTHON_BASE_IMAGE}
ARG PYTHON_MAJOR_MINOR_VERSION
ENV PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION}
ARG PIP_VERSION
ENV PIP_VERSION=${PIP_VERSION}
ARG AIRFLOW_PIP_VERSION
ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION}
# Make sure noninteractive debian install is used and language variables set
ENV DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \
@ -171,7 +171,7 @@ RUN if [[ -f /docker-context-files/.pypirc ]]; then \
cp /docker-context-files/.pypirc /root/.pypirc; \
fi
RUN pip install --upgrade "pip==${PIP_VERSION}"
RUN pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"
# By default we do not use pre-cached packages, but in CI/Breeze environment we override this to speed up
# builds in case setup.py/setup.cfg changed. This is pure optimisation of CI/Breeze builds.
@ -323,8 +323,8 @@ ENV AIRFLOW_VERSION=${AIRFLOW_VERSION}
ENV DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \
LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8
ARG PIP_VERSION
ENV PIP_VERSION=${PIP_VERSION}
ARG AIRFLOW_PIP_VERSION
ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION}
# Install curl and gnupg2 - needed for many other installation steps
RUN apt-get update \
@ -428,7 +428,7 @@ COPY --chown=airflow:root scripts/in_container/prod/entrypoint_prod.sh /entrypoi
COPY --chown=airflow:root scripts/in_container/prod/clean-logs.sh /clean-logs
RUN chmod a+x /entrypoint /clean-logs
RUN pip install --upgrade "pip==${PIP_VERSION}"
RUN pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"
# Make /etc/passwd root-group-writeable so that user can be dynamically added by OpenShift
# See https://github.com/apache/airflow/issues/9248

Просмотреть файл

@ -29,8 +29,8 @@ ENV AIRFLOW_VERSION=$AIRFLOW_VERSION
ARG PYTHON_MAJOR_MINOR_VERSION="3.6"
ENV PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION}
ARG PIP_VERSION=20.2.4
ENV PIP_VERSION=${PIP_VERSION}
ARG AIRFLOW_PIP_VERSION=20.2.4
ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION}
# Print versions
RUN echo "Base image: ${PYTHON_BASE_IMAGE}"
@ -271,7 +271,7 @@ ENV INSTALL_FROM_DOCKER_CONTEXT_FILES=${INSTALL_FROM_DOCKER_CONTEXT_FILES}
ARG INSTALL_FROM_PYPI="true"
ENV INSTALL_FROM_PYPI=${INSTALL_FROM_PYPI}
RUN pip install --upgrade "pip==${PIP_VERSION}"
RUN pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"
# In case of CI builds we want to pre-install master version of airflow dependencies so that
# We do not have to always reinstall it from the scratch.
@ -322,10 +322,10 @@ ENV UPGRADE_TO_LATEST_CONSTRAINTS=${UPGRADE_TO_LATEST_CONSTRAINTS}
RUN if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
if [[ "${UPGRADE_TO_LATEST_CONSTRAINTS}" != "false" ]]; then \
pip install -e ".[${AIRFLOW_EXTRAS}]" --upgrade --upgrade-strategy eager; \
pip install --upgrade "pip==${PIP_VERSION}"; \
pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
else \
pip install -e ".[${AIRFLOW_EXTRAS}]" --upgrade --upgrade-strategy only-if-needed; \
pip install --upgrade "pip==${PIP_VERSION}"; \
pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
fi; \
fi

Просмотреть файл

@ -86,7 +86,7 @@ fi
. "${virtualenv_path}/bin/activate"
pip install --upgrade "pip==${PIP_VERSION}" "wheel==${WHEEL_VERSION}"
pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}" "wheel==${WHEEL_VERSION}"
pip install pytest freezegun pytest-cov \
--constraint "https://raw.githubusercontent.com/apache/airflow/${DEFAULT_CONSTRAINTS_BRANCH}/constraints-${HOST_PYTHON_VERSION}.txt"

Просмотреть файл

@ -21,7 +21,7 @@ function build_airflow_packages::build_airflow_packages() {
rm -rf -- *egg-info*
rm -rf -- build
pip install --upgrade "pip==${PIP_VERSION}" "wheel==${WHEEL_VERSION}"
pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}" "wheel==${WHEEL_VERSION}"
local packages=()

Просмотреть файл

@ -174,8 +174,8 @@ function initialization::initialize_base_variables() {
export INSTALLED_EXTRAS="async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,imap,google,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv"
# default version of PIP USED (This has to be < 20.3 until https://github.com/apache/airflow/issues/12838 is solved)
PIP_VERSION=${PIP_VERSION:="20.2.4"}
export PIP_VERSION
AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION:="20.2.4"}
export AIRFLOW_PIP_VERSION
# We also pin version of wheel used to get consistent builds
WHEEL_VERSION=${WHEEL_VERSION:="0.36.1"}