Skip to content

Commit becfb3c

Browse files
authored
Fix endless loop of defer in cloud_build (#32387)
1 parent e4757d6 commit becfb3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

β€Žairflow/providers/google/cloud/triggers/cloud_build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ async def run(self) -> AsyncIterator[TriggerEvent]: # type: ignore[override]
9595
"message": "Build completed",
9696
}
9797
)
98+
return
9899
elif cloud_build_instance._pb.status in (
99100
Build.Status.WORKING,
100101
Build.Status.PENDING,
@@ -111,14 +112,17 @@ async def run(self) -> AsyncIterator[TriggerEvent]: # type: ignore[override]
111112
Build.Status.EXPIRED,
112113
):
113114
yield TriggerEvent({"status": "error", "message": cloud_build_instance.status_detail})
115+
return
114116
else:
115117
yield TriggerEvent(
116118
{"status": "error", "message": "Unidentified status of Cloud Build instance"}
117119
)
120+
return
118121

119122
except Exception as e:
120123
self.log.exception("Exception occurred while checking for Cloud Build completion")
121124
yield TriggerEvent({"status": "error", "message": str(e)})
125+
return
122126

123127
def _get_async_hook(self) -> CloudBuildAsyncHook:
124128
return CloudBuildAsyncHook(gcp_conn_id=self.gcp_conn_id)

0 commit comments

Comments
 (0)