Overview
The GCP Cloud Build integration works by adding a webhook step to yourcloudbuild.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
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:
Variable | Example Value | Description |
---|---|---|
_BUGSTER_API_KEY | bugster_xxx | Your Bugster API key |
_PROJECT_ID | my-project-1234567890 | Bugster project identifier |
_ORG_ID | org_abc123def456ghi789jkl | Bugster organization identifier |
_DEPLOYMENT_URL | https://preview.example.com | Public URL where your app is deployed |
_BRANCH_NAME | main | Target 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
- Go to Cloud Build > Triggers > Create Trigger
- Select your GitHub repository
- Set Event to “Pull request”
- Set Target branch to
main
(or your preferred branch) - Set Configuration to “Cloud Build configuration file”
- Set Configuration file location to
/cloudbuild.yaml
(or your file path) - Add the substitution variables from Step 3
- 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
Conditional Webhook Execution
Only trigger Bugster for specific branches or conditions:cloudbuild.yaml
Troubleshooting
Webhook step fails with authentication error
Webhook step fails with authentication error
- Verify your
_BUGSTER_API_KEY
is correct and hasn’t expired - Check that the API key has proper permissions in your Bugster dashboard
- Ensure the
X-API-KEY
header is properly formatted in yourcloudbuild.yaml
Tests not running after successful webhook
Tests not running after successful webhook
- Confirm your
_DEPLOYMENT_URL
is publicly accessible - Verify your repository has the
.bugster
configuration folder - Check that
deployment_state
is set to"success"
- Ensure your
_PROJECT_ID
and_ORG_ID
are correct
Build fails on webhook step
Build fails on webhook step
- Check Cloud Build logs for specific curl error messages
- Verify all substitution variables are properly configured
- Ensure the
curlimages/curl
image is accessible in your project
Substitution variables not resolving
Substitution variables not resolving
- Confirm variables are defined in your Cloud Build trigger settings
- Check variable names match exactly (including underscores)
- Verify you’re using
${VARIABLE_NAME}
syntax in your YAML file
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