Skip to content

Commit

Permalink
Fix --use-airflow-version constraints (apache#36378)
Browse files Browse the repository at this point in the history
When `--use-airflow-version` is a numeric or rc version, the constraints
should be specific for that version when installing airflow. For example
when we install 2.7.3rc1, `constraints-2.7.3rc1` should be used.

This has been lost when fixing version in CI.

This PR introduces these fixes:

* default varlue for airflow constraints is DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH

* when --use-airflow-version is numeric version and default value is
  used for constraints (DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH) then it
  is replaced with `constraints-VERSION`

* when we print out constraints used, we print which are the
  constraints used by Airflow and which by providers.
  • Loading branch information
potiuk authored Dec 23, 2023
1 parent ff3b8da commit 5ddd67a
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

import click

from airflow_breeze.branch_defaults import DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH
from airflow_breeze.global_constants import ALLOWED_CONSTRAINTS_MODES_CI, ALLOWED_CONSTRAINTS_MODES_PROD
from airflow_breeze.utils.custom_param_types import BetterChoice

option_airflow_constraints_reference = click.option(
"--airflow-constraints-reference",
help="Constraint reference to use for airflow installation (used in calculated constraints URL). "
"Can be 'default' in which case the default constraints-reference is used.",
default=DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH,
help="Constraint reference to use for airflow installation (used in calculated constraints URL).",
envvar="AIRFLOW_CONSTRAINTS_REFERENCE",
)
option_airflow_constraints_location = click.option(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
71725748176f8e86b78433c6ab8fa698
aba68f434b87d954ad27f594031bb919
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
505041dc3cf367fe381126db0b62c4a5
2d128022c661ad702c6236dd75dd8531
104 changes: 50 additions & 54 deletions images/breeze/output_shell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/breeze/output_shell.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1721fbbc6f8794c0d671be243bcb6f50
a1b6c6d56b8a06f741dde59a01f71338
82 changes: 39 additions & 43 deletions images/breeze/output_start-airflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/breeze/output_start-airflow.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f08786008dc6552dd92880a45ed5771a
0543b012b7058e62a807609e8dfc5139
5 changes: 4 additions & 1 deletion scripts/in_container/install_airflow_and_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ def calculate_constraints_location(
constraints_reference: str | None,
github_repository: str,
python_version: str,
providers: bool,
):
constraints_base = f"https://raw.githubusercontent.com/{github_repository}/{constraints_reference}"
location = f"{constraints_base}/{constraints_mode}-{python_version}.txt"
console.print(f"[info]Determined constraints as: {location}")
console.print(f"[info]Determined {'providers' if providers else 'airflow'} constraints as: {location}")
return location


Expand Down Expand Up @@ -126,6 +127,7 @@ def get_airflow_constraints_location(
constraints_reference=airflow_constraints_reference,
github_repository=github_repository,
python_version=python_version,
providers=False,
)


Expand Down Expand Up @@ -157,6 +159,7 @@ def get_providers_constraints_location(
constraints_reference=providers_constraints_reference,
python_version=python_version,
github_repository=github_repository,
providers=True,
)


Expand Down

0 comments on commit 5ddd67a

Please sign in to comment.