我正在尝试使用谷歌云构建。在一个步骤中,我需要获取所有正在运行的计算实例的列表。
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list']
它工作正常。当我尝试将输出保存到文件时出现问题
试验一:失败
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list', '> gce-list.txt']
试验 2:失败
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list', '>', 'gce-list.txt']
试验 3:失败
- name: gcr.io/cloud-builders/gcloud
args: >
compute instances list > gce-list.txt
试验4:失败
- name: gcr.io/cloud-builders/gcloud
args: |
compute instances list > gce-list.txt
更新:2018-09-04 17:50
试验 5:失败
- 基于ubuntu搭建gcloud镜像
- 使用该图像运行自定义脚本文件“list-gce.sh”
- 列出 gce.sh 调用
gcloud compute instances list
有关更多详细信息,您可以查看此要点: https ://gist.github.com/mahmoud-samy/e67f141e8b5d553de68a58a30a432ed2
不幸的是,我收到了这个奇怪的错误:
第 1 版
错误:(gcloud)无法识别的参数:列表(您的意思是“列表”吗?)
第 2 版
错误:(gcloud)无法识别的参数:--version(您的意思是“--version”吗?)
有什么建议或参考吗?