如何将谷歌云构建步骤文本输出保存到文件 [英] How can I save google cloud build step text output to file
问题描述
我正在尝试使用谷歌云构建.在一个步骤中,我需要获取所有正在运行的计算实例的列表.
- 名称:gcr.io/cloud-builders/gcloud参数:['计算','实例','列表']
而且它工作正常.当我尝试将输出保存到文件时出现问题
<小时>试验 1:失败
- 名称:gcr.io/cloud-builders/gcloud参数:['计算','实例','列表','>gce-list.txt']
<小时>
试验 2:失败
- 名称:gcr.io/cloud-builders/gcloud参数:['计算','实例','列表','>','gce-list.txt']
<小时>
试验 3:失败
- 名称:gcr.io/cloud-builders/gcloud参数:>计算实例列表 >gce-list.txt
<小时>
试验 4:失败
- 名称:gcr.io/cloud-builders/gcloud参数: |计算实例列表 >gce-list.txt
<小时>
更新:2018-09-04 17:50
试验 5:失败
- 基于 ubuntu 构建 gcloud 镜像
- 使用该图像运行自定义脚本文件list-gce.sh"
- list-gce.sh 调用
gcloud 计算实例列表
有关更多详细信息,您可以查看此要点:https://gist.github.com/mahmoud-samy/e67f141e8b5d553de62a5> 不幸的是我遇到了这个奇怪的错误: 版本 1 错误:(gcloud) 无法识别的参数:列表(您的意思是列表"吗?) 版本 2 错误:(gcloud) 无法识别的参数:--version(您的意思是--version"吗?) 有什么建议或参考吗? 除了其他答案,做 I'm trying to use google cloud build. At one step, I need to get a list of all running compute instances. and it works fine. Problem starts when I tried to save the output to a file Trial 1: failed
Trial 2: failed
Trial 3: failed
Trial 4: failed
UPDATE: 2018-09-04 17:50 Trial 5: failed For more details you can check this gist:
https://gist.github.com/mahmoud-samy/e67f141e8b5d553de68a58a30a432ed2 Unfortunately I got this strange error: rev 1 ERROR: (gcloud) unrecognized arguments: list (did you mean 'list'?) rev 2 ERROR: (gcloud) unrecognized arguments: --version (did you mean '--version'?) Any suggestions, or references? In addition to other answers, to do
这篇关于如何将谷歌云构建步骤文本输出保存到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!cmd>foo.txt
,您需要将构建入口点覆盖为 bash(或 sh):- 名称:gcr.io/cloud-builders/gcloud入口点:/bin/bashargs: ['-c', 'gcloud 计算实例列表 >gce-list.txt']
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list']
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list', '> gce-list.txt']
- name: gcr.io/cloud-builders/gcloud
args: ['compute', 'instances', 'list', '>', 'gce-list.txt']
- name: gcr.io/cloud-builders/gcloud
args: >
compute instances list > gce-list.txt
- name: gcr.io/cloud-builders/gcloud
args: |
compute instances list > gce-list.txt
gcloud compute instances list
cmd > foo.txt
, you need to override the build entrypoint to bash (or sh):- name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args: ['-c', 'gcloud compute instances list > gce-list.txt']