You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/10/18 15:08:46 UTC

[airflow] 11/13: Fix problem with building providers where constraints are conflicting (#26420)

This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit e271d16080ef5a5c0fcc765860e9edb04f9677ae
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Thu Sep 15 17:37:08 2022 +0200

    Fix problem with building providers where constraints are conflicting (#26420)
    
    When constraints are conflicting with Airflow's requirement,
    the provider build fails. This change makes it retry the installation
    without constraints in such case.
    
    (cherry picked from commit 954a5510e5324cb78c9b386c750eb4168f1c8f53)
---
 scripts/in_container/_in_container_utils.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/scripts/in_container/_in_container_utils.sh b/scripts/in_container/_in_container_utils.sh
index 7cb8837112..3634d1dea8 100644
--- a/scripts/in_container/_in_container_utils.sh
+++ b/scripts/in_container/_in_container_utils.sh
@@ -202,8 +202,17 @@ function install_airflow_from_wheel() {
     if [[ ${constraints_reference} == "none" ]]; then
         pip install "${airflow_package}${extras}"
     else
+        set +e
         pip install "${airflow_package}${extras}" --constraint \
             "https://raw.githubusercontent.com/apache/airflow/${constraints_reference}/constraints-${PYTHON_MAJOR_MINOR_VERSION}.txt"
+        res=$?
+        set -e
+        if [[ ${res} != "0" ]]; then
+            >&2 echo
+            >&2 echo "WARNING! Could not install provider packages with constraints, falling back to no-constraints mode"
+            >&2 echo
+            pip install "${airflow_package}${extras}"
+        fi
     fi
 }
 
@@ -232,8 +241,17 @@ function install_airflow_from_sdist() {
     if [[ ${constraints_reference} == "none" ]]; then
         pip install "${airflow_package}${extras}"
     else
+        set +e
         pip install "${airflow_package}${extras}" --constraint \
             "https://raw.githubusercontent.com/apache/airflow/${constraints_reference}/constraints-${PYTHON_MAJOR_MINOR_VERSION}.txt"
+        res=$?
+        set -e
+        if [[ ${res} != "0" ]]; then
+            >&2 echo
+            >&2 echo "WARNING! Could not install provider packages with constraints, falling back to no-constraints mode"
+            >&2 echo
+            pip install "${airflow_package}${extras}"
+        fi
     fi
 }