GCP · Serverless
Cloud Functions
Event-driven serverless functions.
Official docsOverview
Cloud Functions (2nd gen, built on Cloud Run) runs single-purpose functions triggered by HTTP, Pub/Sub, Storage, Firestore or Eventarc.
When to use it
- Webhooks (CI status, test result fan-out)
- Lightweight ETL between QA datasources
- Reacting to bucket uploads to parse reports
Setup
- Enable Cloud Functions, Cloud Build and Eventarc APIs.
- Write handler (Node/Python/Go/Java).
- Deploy with `gcloud functions deploy` specifying trigger and runtime.
How to use
Deploy HTTP function
gcloud functions deploy parse-report \
--gen2 --runtime=nodejs20 \
--trigger-http --entry-point=handler --region=us-central1Trigger on bucket upload
gcloud functions deploy on-report \
--gen2 --runtime=python311 \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket=qa-reports"QA use cases
- Parse uploaded JUnit XML and push metrics to BigQuery.
- Slack notifier for failed test runs via Pub/Sub.
