Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

gcloud - How can I save google cloud build step text output to file

I'm trying to use google cloud build. At one step, I need to get a list of all running compute instances.

- name: gcr.io/cloud-builders/gcloud
  args: ['compute', 'instances', 'list']

and it works fine. Problem starts when I tried to save the output to a file


Trial 1: failed

- name: gcr.io/cloud-builders/gcloud
  args: ['compute', 'instances', 'list', '> gce-list.txt']

Trial 2: failed

- name: gcr.io/cloud-builders/gcloud
  args: ['compute', 'instances', 'list', '>', 'gce-list.txt']

Trial 3: failed

- name: gcr.io/cloud-builders/gcloud
  args: >
      compute instances list > gce-list.txt

Trial 4: failed

- name: gcr.io/cloud-builders/gcloud
  args: |
      compute instances list > gce-list.txt

UPDATE: 2018-09-04 17:50

Trial 5: failed

  1. Build an gcloud image based on ubuntu
  2. Used that image to run custom script file 'list-gce.sh'
  3. list-gce.sh calls gcloud compute instances list

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...