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 2025/05/04 09:58:04 UTC

(airflow) branch v3-0-test updated: [v3-0-test] Additional validation of whether constraints are available for images (#50167) (#50171)

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

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 1455799cc29 [v3-0-test] Additional validation of whether constraints are available for images (#50167) (#50171)
1455799cc29 is described below

commit 1455799cc29bf088179fd085326810a5ab29f0d7
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Sun May 4 11:57:55 2025 +0200

    [v3-0-test] Additional validation of whether constraints are available for images (#50167) (#50171)
    
    When releasing the images, we are supposed to use constraints to release
    the images - and when the constraints are not present, we should not
    even attempt to do so.
    
    This additional check verifies that constraints for the airflow version
    which we use to release the image is present in the repo.
    (cherry picked from commit dd133592aaa5cf06a5cfd68843d4d18ffb578dde)
    
    Co-authored-by: Jarek Potiuk <ja...@potiuk.com>
---
 scripts/ci/airflow_version_check.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/scripts/ci/airflow_version_check.py b/scripts/ci/airflow_version_check.py
index 20502aff400..9587f5378b9 100755
--- a/scripts/ci/airflow_version_check.py
+++ b/scripts/ci/airflow_version_check.py
@@ -26,7 +26,9 @@
 # ///
 from __future__ import annotations
 
+import re
 import sys
+from pathlib import Path
 
 import requests
 from packaging.version import Version
@@ -59,6 +61,28 @@ def check_airflow_version(airflow_version: Version) -> tuple[str, bool]:
             sys.exit(1)
         if airflow_version == latest_version:
             latest = True
+        # find requires-python = "~=VERSION" in pyproject.toml file of airflow
+        pyproject_toml_conntent = (Path(__file__).parents[2] / "pyproject.toml").read_text()
+        matched_version = re.search('requires-python = "~=([0-9]+.[0-9]+)', pyproject_toml_conntent)
+        if matched_version:
+            min_version = matched_version.group(1)
+        else:
+            console.print("[red]Error: requires-python version not found in pyproject.toml")
+            sys.exit(1)
+        constraints_url = (
+            f"https://raw.githubusercontent.com/apache/airflow/"
+            f"constraints-{airflow_version}/constraints-{min_version}.txt"
+        )
+        console.print(f"[bright_blue]Checking constraints file: {constraints_url}")
+        response = requests.head(constraints_url)
+        if response.status_code == 404:
+            console.print(
+                f"[red]Error: Constraints file not found for version {airflow_version}. "
+                f"Please set appropriate tag."
+            )
+            sys.exit(1)
+        response.raise_for_status()
+        console.print(f"[green]Constraints file found for version {airflow_version}, Python {min_version}")
         return str(airflow_version), latest
     except Exception as e:
         console.print(f"[red]Error fetching latest version: {e}")