'executing various steps in cloud build

I want to execute 3 steps in the same cloud build yaml but I get this error: ERROR while parsing a block mapping

steps:

- name: 'git image'
  args: [args]
  id: 'Clone Repository'

# Compile the pipeline.
- name: 'custom image'
  entrypoint: 'python'
  args: [args]
  
  id: 'Compile Pipeline'

artifacts:
    objects:
      location: '$_GCS_LOCATION'
      paths: ['path']


- name: 'custom image'
  entrypoint: 'python'
  args: ['args']
          
  id: 'Trigger Pipeline'

logsBucket: 'project-bucket-logs'

serviceAccount: 'service-account'

I get the error in the last:

  • name expected , but found '-'


Solution 1:[1]

You have a different indent after artifacts: so this yaml file is not parsed the way you'd like. This part should look like this:

artifacts:
  objects:
    location: '$_GCS_LOCATION'
    paths: ['path']

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mdobrucki