gpt4 book ai didi

linux - 使用 linux .sh 脚本自动选择提示

转载 作者:太空狗 更新时间:2023-10-29 11:43:26 24 4
gpt4 key购买 nike

我正在尝试使用 CircleCI 自动推送到谷歌容器注册表并启动 kubernetes pod 的滚动更新。我有一个 circle.yml 文件,其依赖关系如下:

dependencies:
cache_directories:
- ~/kubernetes
- ./google-cloud-sdk
pre:
- chmod a+x ./download-gcloud.sh ./install-kubernetes.sh ./deploy.sh
- ./download-gcloud.sh
- ./google-cloud-sdk/install.sh <--- This step hangs
- ./google-cloud-sdk/bin/gcloud components update
- ./google-cloud-sdk/bin/gcloud auth activate-service-account $GCLOUD_CLIENT_ID --key-file ./kubernetes/gcloud_pem.p12
- ./install-kubernetes.sh

我可以下载 tar 文件并安装它,但我不确定如何选择提示,因此构建挂起:

Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized data on how
the SDK is used. You may choose to opt out of this collection now (by choosing
'N' at the below prompt), or at any time in the future by running the following
command:

gcloud config set --scope=user disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?

运行安装脚本时是否可以设置一个标志来禁用提示?

最佳答案

以非交互方式安装 Cloud SDK 的推荐方法是设置环境变量 CLOUDSDK_CORE_DISABLE_PROMPTS:

export CLOUDSDK_CORE_DISABLE_PROMPTS=1

这将使 Cloud SDK 在非交互模式下运行,在该模式下它接受所有提示的默认值。这适用于安装和一般操作(这对编写脚本很有用)。

要让它永久化,运行

gcloud config set core/disable_prompts 1

安装 Cloud SDK 后。

关于linux - 使用 linux .sh 脚本自动选择提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31553059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com