Skip to content

Commit bc27355

Browse files
authored
Make building PROD image using sources requirements (apache#46440)
When PROD image is build using sources, it should use source requireents rather than pip requirements - they might be conflicting if the main providers are different than released prividers.
1 parent 7190cb2 commit bc27355

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

dev/breeze/src/airflow_breeze/commands/production_image_commands.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@
8181
option_airflow_constraints_location,
8282
option_airflow_constraints_mode_prod,
8383
)
84-
from airflow_breeze.global_constants import ALLOWED_INSTALLATION_METHODS, DEFAULT_EXTRAS
84+
from airflow_breeze.global_constants import (
85+
ALLOWED_INSTALLATION_METHODS,
86+
CONSTRAINTS_SOURCE_PROVIDERS,
87+
DEFAULT_EXTRAS,
88+
)
8589
from airflow_breeze.params.build_prod_params import BuildProdParams
8690
from airflow_breeze.utils.ci_group import ci_group
8791
from airflow_breeze.utils.click_utils import BreezeGroup
@@ -330,6 +334,10 @@ def run_build(prod_image_params: BuildProdParams) -> None:
330334
get_console().print(f"[error]Error when building image! {info}")
331335
sys.exit(return_code)
332336

337+
if not install_airflow_version and not airflow_constraints_location:
338+
get_console().print(f"[yellow]Using {CONSTRAINTS_SOURCE_PROVIDERS} constraints mode[/]")
339+
airflow_constraints_mode = CONSTRAINTS_SOURCE_PROVIDERS
340+
333341
perform_environment_checks()
334342
check_remote_ghcr_io_commands()
335343
base_build_params = BuildProdParams(

dev/breeze/src/airflow_breeze/global_constants.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,13 @@
148148
START_AIRFLOW_DEFAULT_ALLOWED_EXECUTOR = START_AIRFLOW_ALLOWED_EXECUTORS[0]
149149
ALLOWED_CELERY_EXECUTORS = [CELERY_EXECUTOR, CELERY_K8S_EXECUTOR]
150150

151+
CONSTRAINTS_SOURCE_PROVIDERS = "constraints-source-providers"
152+
CONSTRAINTS = "constraints"
153+
CONSTRAINTS_NO_PROVIDERS = "constraints-no-providers"
154+
151155
ALLOWED_KIND_OPERATIONS = ["start", "stop", "restart", "status", "deploy", "test", "shell", "k9s"]
152-
ALLOWED_CONSTRAINTS_MODES_CI = ["constraints-source-providers", "constraints", "constraints-no-providers"]
153-
ALLOWED_CONSTRAINTS_MODES_PROD = ["constraints", "constraints-no-providers", "constraints-source-providers"]
156+
ALLOWED_CONSTRAINTS_MODES_CI = [CONSTRAINTS_SOURCE_PROVIDERS, CONSTRAINTS, CONSTRAINTS_NO_PROVIDERS]
157+
ALLOWED_CONSTRAINTS_MODES_PROD = [CONSTRAINTS, CONSTRAINTS_NO_PROVIDERS, CONSTRAINTS_SOURCE_PROVIDERS]
154158

155159
ALLOWED_CELERY_BROKERS = ["rabbitmq", "redis"]
156160
DEFAULT_CELERY_BROKER = ALLOWED_CELERY_BROKERS[1]

0 commit comments

Comments
 (0)