Skip to content

Commit 8915db8

Browse files
AchoArnoldCopilot
andcommitted
ci: poll Cloud Build status after showing console link
Show the Cloud Console link immediately, then poll every 30s until the build reaches a terminal state. Fail the pipeline if the build does not succeed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 879806c commit 8915db8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/api.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,14 @@ jobs:
9898
--format="value(metadata.build.id)")
9999
echo "Build ID: $BUILD_ID"
100100
echo "View build logs: https://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=httpsms-86c51"
101+
echo ""
102+
echo "Polling build status..."
103+
while true; do
104+
STATUS=$(gcloud builds describe "$BUILD_ID" --region=global --project=httpsms-86c51 --format="value(status)")
105+
echo " Status: $STATUS"
106+
case "$STATUS" in
107+
SUCCESS) echo "Build succeeded!"; exit 0 ;;
108+
FAILURE|TIMEOUT|CANCELLED|EXPIRED|INTERNAL_ERROR) echo "Build failed with status: $STATUS"; exit 1 ;;
109+
esac
110+
sleep 30
111+
done

0 commit comments

Comments
 (0)