You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2024/03/27 20:41:46 UTC

(airflow) 01/01: Avoid accidentally upgrading airflow in compatibility check

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

potiuk pushed a commit to branch fix-broken-compatibility-check
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 617accfa4d75c9a448f55d46347a0c6b43d80f2d
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Wed Mar 27 21:36:14 2024 +0100

    Avoid accidentally upgrading airflow in compatibility check
    
    When running compatibility check of providers with airflow, we install
    airflow first (with constraints) and providers as the next step (without
    constraints). This might - in some cases lead to accidental upgrade of
    airflow if `pip` decides to do so.
    
    By adding airflow package to the list of providers to install, we will
    keep it from being accidentally upgraded.
---
 scripts/in_container/install_airflow_and_providers.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/in_container/install_airflow_and_providers.py b/scripts/in_container/install_airflow_and_providers.py
index 5e27d79e84..1174474e2e 100755
--- a/scripts/in_container/install_airflow_and_providers.py
+++ b/scripts/in_container/install_airflow_and_providers.py
@@ -500,6 +500,12 @@ def install_airflow_and_providers(
         for provider_package in installation_spec.provider_packages:
             base_install_providers_cmd.append(provider_package)
         install_providers_command = base_install_providers_cmd.copy()
+        # if airflow is also being installed we should add airflow to the base_install_providers_cmd
+        # to avoid accidentally upgrading airflow to a version that is different than installed in the
+        # previous step
+        if installation_spec.airflow_package:
+            base_install_providers_cmd.append(installation_spec.airflow_package)
+
         if installation_spec.provider_constraints_location:
             console.print(
                 f"[bright_blue]with constraints: {installation_spec.provider_constraints_location}\n"