This is an automated email from the ASF dual-hosted git repository.
potiuk 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 e49d6c09947 Add cooldown period to upgrade-important-versions check
(#63606)
e49d6c09947 is described below
commit e49d6c09947a05d896ee27560172ff2fe0f200e9
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Mar 14 18:19:11 2026 +0100
Add cooldown period to upgrade-important-versions check (#63606)
When UPGRADE_COOLDOWN_DAYS is set, the upgrade check will not fail
if there was a recent "Upgrade important" commit within the cooldown
period. This prevents noisy CI failures when versions were recently
addressed. The CI workflow sets a 4-day cooldown matching the existing
prek autoupdate cooldown.
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
---
.github/workflows/basic-tests.yml | 1 +
scripts/ci/prek/upgrade_important_versions.py | 41 +++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/.github/workflows/basic-tests.yml
b/.github/workflows/basic-tests.yml
index c3be7603724..1169ed01ba4 100644
--- a/.github/workflows/basic-tests.yml
+++ b/.github/workflows/basic-tests.yml
@@ -381,6 +381,7 @@ jobs:
UPGRADE_MPROCS: "false"
UPGRADE_PROTOC: "false"
UPGRADE_OPENAPI_GENERATOR: "false"
+ UPGRADE_COOLDOWN_DAYS: "4"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-airflow-release-commands:
diff --git a/scripts/ci/prek/upgrade_important_versions.py
b/scripts/ci/prek/upgrade_important_versions.py
index 8041de4c891..23eb294e36f 100755
--- a/scripts/ci/prek/upgrade_important_versions.py
+++ b/scripts/ci/prek/upgrade_important_versions.py
@@ -416,6 +416,7 @@ def get_env_bool(name: str, default: bool = True) -> bool:
VERBOSE: bool = os.environ.get("VERBOSE", "false") == "true"
UPGRADE_ALL_BY_DEFAULT: bool = os.environ.get("UPGRADE_ALL_BY_DEFAULT",
"true") == "true"
+UPGRADE_COOLDOWN_DAYS: int = int(os.environ.get("UPGRADE_COOLDOWN_DAYS", "0"))
if UPGRADE_ALL_BY_DEFAULT and VERBOSE:
console.print("[bright_blue]Upgrading all important versions")
@@ -848,6 +849,40 @@ def update_pyproject_build_requires(
return changed
+def is_within_cooldown(cooldown_days: int) -> bool:
+ """Check if there was a version upgrade commit within the cooldown period.
+
+ Looks for commits matching the 'Upgrade important' pattern in the git log
+ within the last ``cooldown_days`` days. If found, the upgrade check should
+ not fail because someone recently addressed the versions.
+ """
+ try:
+ result = subprocess.run(
+ [
+ "git",
+ "log",
+ f"--since={cooldown_days} days ago",
+ "--all",
+ "--oneline",
+ "--grep=Upgrade important",
+ ],
+ capture_output=True,
+ text=True,
+ check=True,
+ cwd=AIRFLOW_ROOT_PATH,
+ )
+ if result.stdout.strip():
+ if VERBOSE:
+ console.print(
+ f"[bright_blue]Found recent upgrade commits within
{cooldown_days} days:\n"
+ f"{result.stdout.strip()}"
+ )
+ return True
+ return False
+ except subprocess.CalledProcessError:
+ return False
+
+
def main() -> None:
"""Main entry point for the version upgrade script."""
retrieve_gh_token(description="airflow-upgrade-important-versions",
scopes="public_repo")
@@ -875,6 +910,12 @@ def main() -> None:
sync_breeze_lock_file()
if not os.environ.get("CI"):
console.print("[bright_blue]Please commit the changes")
+ if UPGRADE_COOLDOWN_DAYS > 0 and
is_within_cooldown(UPGRADE_COOLDOWN_DAYS):
+ console.print(
+ f"[bright_yellow]Versions are outdated but within
{UPGRADE_COOLDOWN_DAYS}-day "
+ f"cooldown period (recent upgrade commit found). Not failing."
+ )
+ sys.exit(0)
sys.exit(1)