Cloud Build trigger run via Webhook does not fetch connected repo source code

I have a Cloud Build trigger that fetches some source code from Github and creates a Docker image. I am running this trigger manually. Now I'm trying to invoke it using the Webook provided URL, but every time the build is triggered it fails with the error "Your build failed to run: File cloudbuild.yaml not found". It doesn't seem to checkout the source.

I am making the request using the provided Webhook URL (in the Edit trigger screen) and with the payload:

afranzoia_1-1711145813257.png

This is how it looks in the History screen (no branch or commit ref is shown):

afranzoia_2-1711145849575.png

This is how I have it configured (link to better quality screenshot: https://i.postimg.cc/xjN2P8Nr/Unknown.png 😞

afranzoia_4-1711146057299.png

 

 

I have looked up for help at https://cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.triggers/webhook, but the body documentation seems to be incomplete.

Thanks in advance for any help

 

 

0 1 64
1 REPLY 1

Hi @afranzoia,

Welcome to Google Cloud Community!

Cloud Build Webhook Trigger: Source Code Fetch Issue

Problem: Webhook triggers don't automatically fetch code from repositories.

Solutions:

  1. Recommended: Use repository triggers for automatic builds on code changes. (https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudbuild_trigger)
  2. For Custom Events: Modify webhook payload to include source code location (repository URL, branch name) in JSON format.