Automatically trigger Bugster tests when your Google Cloud Build deployments complete. This integration uses Bugster’s custom webhook API to run tests on your deployed applications.

Overview

The GCP Cloud Build integration works by adding a webhook step to your cloudbuild.yaml file that calls Bugster’s API after your deployment succeeds. This approach gives you full control over when tests are triggered in your build pipeline.
This integration uses the same Custom Integration API that powers other Bugster integrations.

Quick Start

We’ve created a complete example repository to help you get started quickly:

Bugster Cloud Build Example

Complete Next.js application with Cloud Build configuration for Bugster integration

Configuration

1

Add Cloud Build configuration

Create or update your cloudbuild.yaml file to include the Bugster webhook step:
cloudbuild.yaml
steps:
  # Your existing build steps here
  # ...
  
  # Bugster webhook step
  - name: 'curlimages/curl'
    entrypoint: 'curl'
    args:
      - '-X'
      - 'POST'
      - 'https://api.bugster.app/webhooks/integrations/custom'
      - '-H'
      - 'Content-Type: application/json'
      - '-H'
      - 'X-API-KEY: ${_BUGSTER_API_KEY}'
      - '--data'
      - |
        {
          "deployment_state": "success",
          "project_id": "${_PROJECT_ID}",
          "organization_id": "${_ORG_ID}",
          "branch": "${_BRANCH_NAME}",
          "environment_url": "${_DEPLOYMENT_URL}",
          "environment": "production"
        }
options:
  logging: CLOUD_LOGGING_ONLY
Add this step after your deployment is complete and your application is accessible at the target URL.
2

Get your Bugster credentials

Navigate to your Bugster dashboard and collect:
  • API Key: Settings > API Keys
  • Project ID: Project Settings > General
  • Organization ID: Settings > Organization
All three values can also be found in Project Settings > Integrations for convenience.
3

Configure substitution variables

In Google Cloud Console, go to Cloud Build > Triggers and configure these substitution variables:
VariableExample ValueDescription
_BUGSTER_API_KEYbugster_xxxYour Bugster API key
_PROJECT_IDmy-project-1234567890Bugster project identifier
_ORG_IDorg_abc123def456ghi789jklBugster organization identifier
_DEPLOYMENT_URLhttps://preview.example.comPublic URL where your app is deployed
_BRANCH_NAMEmainTarget branch for the trigger
Set these variables once in your Cloud Build trigger configuration - they’ll be available for all builds.
4

Create the Cloud Build trigger

  1. Go to Cloud Build > Triggers > Create Trigger
  2. Select your GitHub repository
  3. Set Event to “Pull request”
  4. Set Target branch to main (or your preferred branch)
  5. Set Configuration to “Cloud Build configuration file”
  6. Set Configuration file location to /cloudbuild.yaml (or your file path)
  7. Add the substitution variables from Step 3
  8. Save the trigger
Your trigger is now configured to run Bugster tests on every pull request to the main branch.

How It Works

1

Developer creates pull request

A developer opens a pull request against your main branch.
2

Cloud Build trigger activates

Google Cloud Build detects the pull request and starts the build process using your cloudbuild.yaml configuration.
3

Application builds and deploys

Your application builds and deploys to the specified environment (e.g., preview URL, staging environment).
4

Bugster webhook triggers

The curl step in your Cloud Build configuration sends a webhook to Bugster with the deployment details.
5

Tests run automatically

Bugster receives the webhook, accesses your deployed application at the provided URL, and runs your test suite automatically.

Advanced Configuration

Custom Environment Variables

You can customize the webhook payload based on your deployment setup:
cloudbuild.yaml
# Example for staging environment
- name: 'curlimages/curl'
  entrypoint: 'curl'
  args:
    - '--data'
    - |
      {
        "deployment_state": "success",
        "project_id": "${_PROJECT_ID}",
        "organization_id": "${_ORG_ID}",
        "commit_sha": "${COMMIT_SHA}",
        "environment_url": "https://${_BRANCH_NAME}-${SHORT_SHA}.example.com",
        "environment": "staging"
      }

Conditional Webhook Execution

Only trigger Bugster for specific branches or conditions:
cloudbuild.yaml
# Only run Bugster webhook for main branch
- name: 'curlimages/curl'
  entrypoint: 'bash'
  args:
    - '-c'
    - |
      if [ "${_BRANCH_NAME}" = "main" ]; then
        curl -X POST 'https://api.bugster.app/webhooks/integrations/custom' \
          -H 'Content-Type: application/json' \
          -H 'X-API-KEY: ${_BUGSTER_API_KEY}' \
          --data '{
            "deployment_state": "success",
            "project_id": "${_PROJECT_ID}",
            "organization_id": "${_ORG_ID}",
            "branch": "${_BRANCH_NAME}",
            "environment_url": "${_DEPLOYMENT_URL}",
            "environment": "production"
          }'
      fi

Troubleshooting

Example Repository

For a complete working example, check out our Bugster Cloud Build Quickstart repository which includes:
  • A Next.js sample application
  • Complete cloudbuild.yaml configuration
  • Bugster test setup in the .bugster folder
  • Detailed README with setup instructions