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

Build failure

Hello Experts, 

Any clues why this build is failing 

 

anupand94_0-1738230685339.png

I have added the Cloud logging options as other posts have suggested, i am using the compute engine service account. 

 

steps:
- id: 'branch name'
name: 'alpine'
entrypoint: 'sh'
args:
- '-c'
- |
echo "***********************"
echo "$BRANCH_NAME"
echo "***********************"

options:
logging: CLOUD_LOGGING_ONLY

- id: 'tf init'
name: 'hashicorp/terraform:1.9.0'
entrypoint: 'sh'
args:

but it doesn't seem to recognise it

 

0 1 90
1 REPLY 1

Hi @anupand94,

Welcome to Google Cloud Community!

The problem you are encountering arises from the options field being improperly positioned within a BuildStep. In Google Cloud Build, the options section must be specified at the top level of your cloudbuild.yaml, rather than within a step.

Workaround:
Move the options field outside of steps, like this: 

 

 

steps:
- id: 'branch name'
  name: 'alpine'
  entrypoint: 'sh'
  args:
    - '-c'
    - |
      echo "***********************"
      echo "$BRANCH_NAME"
      echo "***********************"

- id: 'tf init'
  name: 'hashicorp/terraform:1.9.0'
  entrypoint: 'sh'
  args: []

# Move options to the root level
options:
  logging: CLOUD_LOGGING_ONLY

 

 

Cloud Build expects options to be a global configuration for the entire build process, not an attribute within individual steps.

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.