I am using cloudbuild.yml file
.
I am trying to grab the build output from inside the cloud build and push it to a file. This is how my step looks like:
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args: ['gcloud', 'builds', 'log', '$BUILD_ID', '>buildlog.log']
id: 'fetch-build-log'
This throws me an error saying ERROR: (gcloud.builds.log) unrecognized arguments: >buildlog.log
If I execute that command in cloud shell
, it works fine: gcloud builds log xxxxx-xxxx-xxxx-xxxx-xxxxxxx >guildlog.log
I am not sure why cloud build
considers >buildlog.log
an argument when it is to redirect the output to the file.
Am I missing something here or is there another way of doing it?