Hi, I am trigeering a cloudbuild with a webhook from GITHUB and using inline YAML.
The documentation sed that it can be done with Substitution variables but I get error ‘cloud build substitution variable "invalid character k looking for beginning of’
The issue likely came from invalid characters being passed in the webhook’s payload. Below is the answer based on Google Cloud documentation.
Check for Invalid Characters: Substitution variables in Cloud Build can only contain alphanumeric characters (letters and numbers) and underscores (_). Other characters like dashes (-), periods (.), or any special characters will cause errors.
Using Substitution Variables: Cloud Build offers pre-defined substitutions, and you also have the option to define your own substitutions. These substitutions can be used in your build steps and images, with their values being resolved during the build process.
Sanitize the Webhook Payload: If the webhook from GitHub contains invalid characters, sanitize or preprocess the payload before using it in your build steps. You can either, modify the webhook handler to clean the data. Use a script in the build to clean or replace invalid characters.
If the steps above do not work, you can contact Google Cloud Support for a more in-depth analysis. When contacting them, please provide comprehensive details and include screenshots. This will help them better understand and address your issue.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.