Do not fail when docker context cannot be used (#32497)
This is a follow-up after #32494 and #32463, where autodetection of
docker context has been added. There is a weird relation between
builders and docker context - sometimes they have to be used in sync,
and sometimes not. For example when we are creating a new context
manually (airxflow_cache) to build images in parallel on ARM/x86,
we should use airflow_cache as buider, but the context should
remain "default". On the other hand when we are using "desktop-linux"
builder, we MUST switch the context to "desktop-linux".
This PR is an attempt to make best effort to switch to the same
context as the builder, but instead of failing, we just warn
if can't and continue.
diff --git a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py
index e612358..ca44e9a 100644
--- a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py
+++ b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py
@@ -845,8 +845,6 @@
output = run_command(["docker", "context", "use", context], check=False)
if output.returncode != 0:
get_console().print(
- "[error] Error when switching context. Add `--builder default` to your command "
- "and report the issue on #airflow-breeze channel in Airflow Slack[/]"
+ f"[warning] Could no use the context {context}. Continuing with current context[/]"
)
- sys.exit(output.returncode)
return context