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 6e5a6db5c8a connections import now returns non-zero exit code on 
failure (#64416)
6e5a6db5c8a is described below

commit 6e5a6db5c8a378026a4f907767a5888f648a0204
Author: Henry Chen <[email protected]>
AuthorDate: Mon Mar 30 11:16:17 2026 +0800

    connections import now returns non-zero exit code on failure (#64416)
---
 airflow-ctl/src/airflowctl/ctl/commands/connection_command.py         | 4 ++--
 .../tests/airflow_ctl/ctl/commands/test_connections_command.py        | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/airflow-ctl/src/airflowctl/ctl/commands/connection_command.py 
b/airflow-ctl/src/airflowctl/ctl/commands/connection_command.py
index b1a8a820998..5dcb63ce232 100644
--- a/airflow-ctl/src/airflowctl/ctl/commands/connection_command.py
+++ b/airflow-ctl/src/airflowctl/ctl/commands/connection_command.py
@@ -67,8 +67,8 @@ def import_(args, api_client=NEW_API_CLIENT) -> None:
         response = 
api_client.connections.bulk(BulkBodyConnectionBody(actions=[connection_create_action]))
         if response.create.errors:
             rich.print(f"[red]Failed to import connections: 
{response.create.errors}[/red]")
-            raise SystemExit
+            raise SystemExit(1)
         rich.print(f"[green]Successfully imported {response.create.success} 
connection(s)[/green]")
     except Exception as e:
         rich.print(f"[red]Failed to import connections: {e}[/red]")
-        raise SystemExit
+        raise SystemExit(1)
diff --git 
a/airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py 
b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py
index f944e66ab1f..bdfb759d0a9 100644
--- a/airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py
+++ b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py
@@ -124,11 +124,12 @@ class TestCliConnectionCommands:
         }
 
         expected_json_path.write_text(json.dumps(connection_file))
-        with pytest.raises(SystemExit):
+        with pytest.raises(SystemExit) as exc_info:
             connection_command.import_(
                 self.parser.parse_args(["connections", "import", 
expected_json_path.as_posix()]),
                 api_client=api_client,
             )
+        assert exc_info.value.code == 1
 
     def test_import_without_extra_field(self, api_client_maker, tmp_path, 
monkeypatch):
         """Import succeeds when JSON omits the ``extra`` field (#62653).

Reply via email to