Automate Docker build using Cloud Build

I was trying to create trigger for my cloud build and set my cloudbuild.yaml but keeps this error L: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

I set my cloudbuild.yaml this way:

steps:

build the container image

args: [“build”, “-t”, “gcr.io/$PROJECT_ID/gcpdevops”, “.”]

images:

Please help me…

Is this related to one of our courses? If so, please give me a link to the course and lab, so I have a bit more context.

sure,in GCP DevOps Project>sprint 04>lesson 6 ==>this link
https://learn.kodekloud.com/user/courses/gcp-devops-project/module/f84d8c20-935f-462e-9503-94408617064a/lesson/fa0ed760-ba86-4c44-a074-b6404b10f8c4

I followed all the script from instructor but gives me error which I shared with you earlier.

To make sure your yaml is actually correct, I’ll need you to paste it in again using

# paste your yaml as a code block. Use the </> key to generate the block!!

I’m not sure what was done in the previous lectures to prepare things for using cloudbuild; but having the valid YAML is going to be a first step.

this is code for cloudbuild.yaml

steps:

Build the container image

  • name: “gcr.io/cloud-builders/docker
    args: [“build”, “-t”, “us-central1-docker.pkg.dev/$PROJECT_ID/testrepo/gcpdevops”, “.”]

images:

  • “us-central1-docker.pkg.dev/$PROJECT_ID/testrepo/gcpdevops”