You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2023/03/08 14:44:32 UTC

[airflow] 17/20: Propose to upgrade to newer dependencies in case build CI image fail (#29705)

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

ephraimanierobi pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit ffdb121523ac24ea108dde9c00645cc75dc22768
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Thu Feb 23 03:00:05 2023 +0100

    Propose to upgrade to newer dependencies in case build CI image fail (#29705)
    
    * Propose to upgrade to newer dependencies in case build CI image fail
    
    When build image fails it might be because there might be conflicts
    with current constraints. In case this happens we propose to add
    `--upgrade-to-newer-dependencies` flag.
    
    * Update dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
    
    Co-authored-by: Raphaël Vandon <11...@users.noreply.github.com>
    
    * Update dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
    
    Co-authored-by: Raphaël Vandon <11...@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Raphaël Vandon <11...@users.noreply.github.com>
    (cherry picked from commit f03885421e1ec39280d9dd94cbed73151f6f19ba)
---
 .../airflow_breeze/commands/ci_image_commands.py   | 41 ++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
index b8f996dde6..6b72895952 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -504,24 +504,29 @@ def run_build_ci_image(
                 check=False,
                 output=output,
             )
-            if (
-                build_command_result.returncode != 0
-                and ci_image_params.upgrade_on_failure
-                and not ci_image_params.upgrade_to_newer_dependencies
-            ):
-                ci_image_params.upgrade_to_newer_dependencies = True
-                get_console().print(
-                    "[warning]Attempting to build with upgrade_to_newer_dependencies on failure"
-                )
-                build_command_result = run_command(
-                    prepare_docker_build_command(
-                        image_params=ci_image_params,
-                    ),
-                    cwd=AIRFLOW_SOURCES_ROOT,
-                    text=True,
-                    check=False,
-                    output=output,
-                )
+            if build_command_result.returncode != 0 and not ci_image_params.upgrade_to_newer_dependencies:
+                if ci_image_params.upgrade_on_failure:
+                    ci_image_params.upgrade_to_newer_dependencies = True
+                    get_console().print(
+                        "[warning]Attempting to build with upgrade_to_newer_dependencies on failure"
+                    )
+                    build_command_result = run_command(
+                        prepare_docker_build_command(
+                            image_params=ci_image_params,
+                        ),
+                        cwd=AIRFLOW_SOURCES_ROOT,
+                        text=True,
+                        check=False,
+                        output=output,
+                    )
+                else:
+                    get_console().print(
+                        "[warning]Your image build failed. It could be caused by conflicting dependencies."
+                    )
+                    get_console().print(
+                        "[info]Run "
+                        "`breeze ci-image build --upgrade-to-newer-dependencies` to upgrade them.\n"
+                    )
             if build_command_result.returncode == 0:
                 if ci_image_params.tag_as_latest:
                     build_command_result = tag_image_as_latest(image_params=ci_image_params, output=output)