mik-laj commented on a change in pull request #13422:
URL: https://github.com/apache/airflow/pull/13422#discussion_r550824560



##########
File path: Dockerfile
##########
@@ -247,31 +247,54 @@ ENV 
UPGRADE_TO_NEWER_DEPENDENCIES=${UPGRADE_TO_NEWER_DEPENDENCIES}
 
 WORKDIR /opt/airflow
 
-# remove mysql from extras if client is not installed
+# hadolint ignore=SC2086, SC2010
 RUN if [[ ${INSTALL_MYSQL_CLIENT} != "true" ]]; then \
+        # Remove mysql from extras if client is not installed \
         AIRFLOW_EXTRAS=${AIRFLOW_EXTRAS/mysql,}; \
     fi; \
     if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
         if [[ "${UPGRADE_TO_NEWER_DEPENDENCIES}" != "false" ]]; then \
             pip install --user 
"${AIRFLOW_INSTALLATION_METHOD}[${AIRFLOW_EXTRAS}]${AIRFLOW_INSTALL_VERSION}" \
                 --upgrade --upgrade-strategy eager; \
+            pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \

Review comment:
       In the first comment, I added an example. To show my idea better, I 
prepared the entire commit. Does this solve this problem?
   ```
   From cc68b6ba19a4bc11e5aed3ec01f3e4f86f76f745 Mon Sep 17 00:00:00 2001
   From: =?UTF-8?q?Kamil=20Bregu=C5=82a?= <[email protected]>
   Date: Sat, 2 Jan 2021 01:16:03 +0100
   Subject: Add constraints to prevent upgrade of pip
   
   ---
    Dockerfile | 21 ++++++++++++---------
    1 file changed, 12 insertions(+), 9 deletions(-)
   
   diff --git a/Dockerfile b/Dockerfile
   index 81737a15b..b72d859dc 100644
   --- a/Dockerfile
   +++ b/Dockerfile
   @@ -255,13 +255,13 @@ RUN if [[ ${INSTALL_MYSQL_CLIENT} != "true" ]]; then \
        if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
            if [[ "${UPGRADE_TO_NEWER_DEPENDENCIES}" != "false" ]]; then \
                pip install --user 
"${AIRFLOW_INSTALLATION_METHOD}[${AIRFLOW_EXTRAS}]${AIRFLOW_INSTALL_VERSION}" \
   +                --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
                    --upgrade --upgrade-strategy eager; \
   -            pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
            else \
                pip install --upgrade --upgrade-strategy only-if-needed \
                    --user 
"${AIRFLOW_INSTALLATION_METHOD}[${AIRFLOW_EXTRAS}]${AIRFLOW_INSTALL_VERSION}" \
   +                --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
                    --constraint "${AIRFLOW_CONSTRAINTS_LOCATION}"; \
   -            pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
            fi; \
        fi; \
        if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then \
   @@ -270,12 +270,13 @@ RUN if [[ ${INSTALL_MYSQL_CLIENT} != "true" ]]; then \
            if [[ "${reinstalling_apache_airflow_packages}" != "" ]]; then \
                if [[ "${UPGRADE_TO_NEWER_DEPENDENCIES}" != "false" ]]; then \
                    pip install --force-reinstall --upgrade --upgrade-strategy 
eager \
   +                    --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
                        --user ${reinstalling_apache_airflow_packages}; \
   -                pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
                else \
                    pip install --force-reinstall --upgrade --upgrade-strategy 
only-if-needed \
   -                    --user ${reinstalling_apache_airflow_packages} 
--constraint "${AIRFLOW_CONSTRAINTS_LOCATION}"; \
   -                pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
   +                    --user ${reinstalling_apache_airflow_packages} \
   +                    --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
   +                    --constraint "${AIRFLOW_CONSTRAINTS_LOCATION}"; \
                fi; \
            fi ; \
            # All the others we want to reinstall as-is, without dependencies \
   @@ -287,12 +288,14 @@ RUN if [[ ${INSTALL_MYSQL_CLIENT} != "true" ]]; then \
        fi; \
        if [[ -n "${ADDITIONAL_PYTHON_DEPS}" ]]; then \
            if [[ "${UPGRADE_TO_NEWER_DEPENDENCIES}" != "false" ]]; then \
   -            pip install --user ${ADDITIONAL_PYTHON_DEPS} --upgrade 
--upgrade-strategy eager; \
   -            pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
   +            pip install --user ${ADDITIONAL_PYTHON_DEPS} \
   +                --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
   +                --upgrade --upgrade-strategy eager; \
            else \
   -            pip install --user ${ADDITIONAL_PYTHON_DEPS} --upgrade 
--upgrade-strategy only-if-needed \
   +            pip install --user ${ADDITIONAL_PYTHON_DEPS} \
   +                --upgrade --upgrade-strategy only-if-needed \
   +                --constraint <(echo "pip==${AIRFLOW_PIP_VERSION}") \
                    --constraint "${AIRFLOW_CONSTRAINTS_LOCATION}"; \
   -            pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"; \
            fi; \
        fi; \
        find /root/.local/ -name '*.pyc' -print0 | xargs -0 rm -r || true ; \
   -- 
   2.28.0
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to