我正在尝试使用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)?
运行安装脚本时是否可以设置一个标志来禁用提示?
答案 0 :(得分:3)
以非交互方式安装Cloud SDK的推荐方法是设置环境变量CLOUDSDK_CORE_DISABLE_PROMPTS
:
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
这将使Cloud SDK以非交互模式运行,其中它接受所有提示的默认值。这适用于安装和一般操作(这对脚本有用)。
要使此永久化,请运行
gcloud config set core/disable_prompts 1
安装Cloud SDK后。
答案 1 :(得分:0)
您是否尝试将-q
传递给gcloud?我们执行此操作while running e2e tests in kubernetes来禁止交互式提示。