From 7f5998f2456a2d6f34f9f284273247bd5d3bcdfe Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 7 Mar 2026 21:15:25 +0100 Subject: [PATCH] [v2-11-test] Fallback to no constraint builds for docker-context-files installation (#63051) When building PROD from docker-context-files - i.e. when we run main build with providers built from sources, we should fall back to no constraints build when there is a conflict with constraints. This is a follow up after #62378 (cherry picked from commit fef2e62d6b730a31f5050295d9d1193d63e92fe7) Co-authored-by: Jarek Potiuk --- Dockerfile | 23 ++++++++++++++++--- .../install_from_docker_context_files.sh | 23 ++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c865dafea308..d0c95d4aa8026 100644 --- a/Dockerfile +++ b/Dockerfile @@ -711,11 +711,28 @@ function install_airflow_and_providers_from_docker_context_files(){ echo "${COLOR_BLUE}Installing docker-context-files packages without constraints${COLOR_RESET}" echo set -x - ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ + if ! ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ ${ADDITIONAL_PIP_INSTALL_FLAGS} \ - "${install_airflow_package[@]}" "${installing_providers_packages[@]}" - set +x + "${install_airflow_package[@]}" "${installing_providers_packages[@]}"; then + set +x + if [[ ${AIRFLOW_FALLBACK_NO_CONSTRAINTS_INSTALLATION} != "true" ]]; then + echo + echo "${COLOR_RED}Failing because constraints installation failed and fallback is disabled.${COLOR_RESET}" + echo + exit 1 + fi + echo + echo "${COLOR_YELLOW}Likely there are new dependencies conflicting with constraints.${COLOR_RESET}" + echo + echo "${COLOR_BLUE}Falling back to no-constraints installation.${COLOR_RESET}" + echo + set -x + ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ + ${ADDITIONAL_PIP_INSTALL_FLAGS} \ + "${install_airflow_package[@]}" "${installing_providers_packages[@]}" + fi fi + set +x common::install_packaging_tools pip check } diff --git a/scripts/docker/install_from_docker_context_files.sh b/scripts/docker/install_from_docker_context_files.sh index edcb50c82e054..5e416b307637b 100644 --- a/scripts/docker/install_from_docker_context_files.sh +++ b/scripts/docker/install_from_docker_context_files.sh @@ -106,11 +106,28 @@ function install_airflow_and_providers_from_docker_context_files(){ echo "${COLOR_BLUE}Installing docker-context-files packages without constraints${COLOR_RESET}" echo set -x - ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ + if ! ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ ${ADDITIONAL_PIP_INSTALL_FLAGS} \ - "${install_airflow_package[@]}" "${installing_providers_packages[@]}" - set +x + "${install_airflow_package[@]}" "${installing_providers_packages[@]}"; then + set +x + if [[ ${AIRFLOW_FALLBACK_NO_CONSTRAINTS_INSTALLATION} != "true" ]]; then + echo + echo "${COLOR_RED}Failing because constraints installation failed and fallback is disabled.${COLOR_RESET}" + echo + exit 1 + fi + echo + echo "${COLOR_YELLOW}Likely there are new dependencies conflicting with constraints.${COLOR_RESET}" + echo + echo "${COLOR_BLUE}Falling back to no-constraints installation.${COLOR_RESET}" + echo + set -x + ${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} \ + ${ADDITIONAL_PIP_INSTALL_FLAGS} \ + "${install_airflow_package[@]}" "${installing_providers_packages[@]}" + fi fi + set +x common::install_packaging_tools pip check }