Skip to content

Commit 9235572

Browse files
AchoArnoldCopilot
andcommitted
ci: wait for Cloud Build completion and stream logs
Capture the build ID from the trigger and stream logs until the build finishes. The GitHub Action step will fail if Cloud Build fails, providing feedback directly in the CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4737e6e commit 9235572

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/api.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
id-token: write
1414

1515
jobs:
16-
integration-test:
16+
test:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout 🛎
@@ -75,21 +75,25 @@ jobs:
7575

7676
deploy:
7777
runs-on: ubuntu-latest
78-
needs: integration-test
78+
needs: test
7979
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
8080
steps:
81-
- name: Authenticate to Google Cloud 🔐
81+
- name: Authenticate to Google Cloud
8282
uses: google-github-actions/auth@v2
8383
with:
8484
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
8585
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
8686

87-
- name: Set up Cloud SDK ☁️
88-
uses: google-github-actions/setup-gcloud@v2
87+
- name: Set up Cloud SDK
88+
uses: google-github-actions/setup-gcloud@v3
8989

9090
- name: Trigger Cloud Build Deploy 🚀
9191
run: |
92-
gcloud builds triggers run api-httpsms-com \
92+
BUILD_ID=$(gcloud builds triggers run api-httpsms-com \
9393
--region=global \
9494
--project=httpsms-86c51 \
95-
--sha=${{ github.sha }}
95+
--sha=${{ github.sha }} \
96+
--format="value(metadata.build.id)")
97+
echo "Build ID: $BUILD_ID"
98+
echo "Streaming build logs..."
99+
gcloud builds log "$BUILD_ID" --region=global --project=httpsms-86c51 --stream

0 commit comments

Comments
 (0)