Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Logging configuration error required in cloud build with Dockerfile?

The following error appears when trying to run a Cloud Build trigger of a Dockerfile from a github repository. Of course, I can simply just make a yaml file and base the build off that, but how do I make it work with a simple Dockerfile or is there any way to supply these configurations within a Dockerfile?

Failed to trigger build: generic::invalid_argument: if 'build.service_account' is specified, the build must either (a) specify 'build.logs_bucket', (b) use the REGIONAL_USER_OWNED_BUCKET build.options.default_logs_bucket_behavior option, or (c) use either CLOUD_LOGGING_ONLY / NONE logging options

 

0 1 444
1 REPLY 1

Hi @saeltorres

Welcome to Google Cloud Community!

I suggest to use a Cloud Build config file and specify the CLOUD_LOGGING_ONLY as logging mode at the end of the yaml file. Ensure that the service account you are using has the Logs Writer permission and the Cloud Build API and IAM API are enabled.

You may also check this troubleshooting build error and Stack Overflow post for some insight that may help you with the issue.

I hope the above information is helpful.