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

eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d12f490e68 Account for min airflow version while preparing providers 
(#49876)
7d12f490e68 is described below

commit 7d12f490e683b4645c20abad4c2db09780212ba3
Author: Amogh Desai <[email protected]>
AuthorDate: Mon Apr 28 18:40:46 2025 +0530

    Account for min airflow version while preparing providers (#49876)
    
    * Account for min airflow version while preparing providers
    
    * better precedence
    
    * elad review
    
    * elad review
---
 .../prepare_providers/provider_documentation.py    | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py 
b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
index a8ade2388ec..0aa0ffdf15f 100644
--- a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
+++ b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
@@ -110,14 +110,16 @@ class TypeOfChange(Enum):
     BREAKING_CHANGE = "x"
     SKIP = "s"
     MISC = "m"
+    MIN_AIRFLOW_VERSION_BUMP = "v"
 
 
 # defines the precedence order for provider version bumps
-# BREAKING_CHANGE > FEATURE > BUGFIX > MISC > DOCUMENTATION > SKIP
+# BREAKING_CHANGE > FEATURE > BUGFIX > MIN_AIRFLOW_VERSION_BUMP > MISC > 
DOCUMENTATION > SKIP
 precedence_order = {
     TypeOfChange.SKIP: 0,
     TypeOfChange.DOCUMENTATION: 1,
     TypeOfChange.MISC: 2,
+    TypeOfChange.MIN_AIRFLOW_VERSION_BUMP: 2.5,
     TypeOfChange.BUGFIX: 3,
     TypeOfChange.FEATURE: 4,
     TypeOfChange.BREAKING_CHANGE: 5,
@@ -187,6 +189,7 @@ TYPE_OF_CHANGE_DESCRIPTION = {
     TypeOfChange.FEATURE: "Feature changes - bump in MINOR version needed",
     TypeOfChange.BREAKING_CHANGE: "Breaking changes - bump in MAJOR version 
needed",
     TypeOfChange.MISC: "Miscellaneous changes - bump in PATCHLEVEL version 
needed",
+    TypeOfChange.MIN_AIRFLOW_VERSION_BUMP: "Airflow version bump change - bump 
in MINOR version needed",
 }
 
 
@@ -506,13 +509,13 @@ def bump_version(v: Version, index: int) -> Version:
 
 
 def _update_version_in_provider_yaml(
-    provider_id: str,
-    type_of_change: TypeOfChange,
+    provider_id: str, type_of_change: TypeOfChange, min_airflow_version_bump: 
bool = False
 ) -> tuple[bool, bool, str]:
     """
     Updates provider version based on the type of change selected by the user
     :param type_of_change: type of change selected
     :param provider_id: provider package
+    :param min_airflow_version_bump: if set, ensure that the version bump is 
at least feature version.
     :return: tuple of two bools: (with_breaking_change, 
maybe_with_new_features, original_text)
     """
     provider_details = get_provider_details(provider_id)
@@ -533,6 +536,8 @@ def _update_version_in_provider_yaml(
         v = bump_version(v, VERSION_PATCHLEVEL_INDEX)
     elif type_of_change == TypeOfChange.MISC:
         v = bump_version(v, VERSION_PATCHLEVEL_INDEX)
+        if min_airflow_version_bump:
+            v = bump_version(v, VERSION_MINOR_INDEX)
     provider_yaml_path = get_provider_yaml(provider_id)
     original_provider_yaml_content = provider_yaml_path.read_text()
     updated_provider_yaml_content = re.sub(
@@ -797,6 +802,10 @@ def update_release_notes(
                 f"[special]{TYPE_OF_CHANGE_DESCRIPTION[type_of_change]}"
             )
             get_console().print()
+            bump = False
+            if type_of_change == TypeOfChange.MIN_AIRFLOW_VERSION_BUMP:
+                bump = True
+                type_of_change = TypeOfChange.MISC
             if type_of_change in [
                 TypeOfChange.BUGFIX,
                 TypeOfChange.FEATURE,
@@ -804,7 +813,9 @@ def update_release_notes(
                 TypeOfChange.MISC,
             ]:
                 with_breaking_changes, maybe_with_new_features, 
original_provider_yaml_content = (
-                    _update_version_in_provider_yaml(provider_id=provider_id, 
type_of_change=type_of_change)
+                    _update_version_in_provider_yaml(
+                        provider_id=provider_id, 
type_of_change=type_of_change, min_airflow_version_bump=bump
+                    )
                 )
                 if not reapply_templates_only:
                     _update_source_date_epoch_in_provider_yaml(provider_id)
@@ -851,9 +862,14 @@ def update_release_notes(
             TypeOfChange.BREAKING_CHANGE,
             TypeOfChange.MISC,
         ]:
+            bump = False
+            if type_of_change == TypeOfChange.MIN_AIRFLOW_VERSION_BUMP:
+                bump = True
+                type_of_change = TypeOfChange.MISC
             with_breaking_changes, maybe_with_new_features, _ = 
_update_version_in_provider_yaml(
                 provider_id=provider_id,
                 type_of_change=type_of_change,
+                min_airflow_version_bump=bump,
             )
             if not reapply_templates_only:
                 _update_source_date_epoch_in_provider_yaml(provider_id)

Reply via email to