我的部署命令如下:
gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote &
您可以假设此命令正在使用我传递的变量。我尝试了以下变化:
var=$(...)
var=$(gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote &)
echo ******************************
echo "${var}"
echo ******************************var=`...`
var=`gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote &`
echo ******************************
echo $var
echo ******************************
--verbosity="warning"
var=$(gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote --verbosity="warning" &)
--verbosity="error"
var=$(gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote --verbosity="error" &)
--log-http
var=$(gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote --log-http &)
--user-output-enabled
var=$(gcloud app deploy --version $version --project my-app-$environment $micro.yaml --quiet $no_promote --user-output-enabled &)
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
ERROR: (gcloud.app.deploy) ABORTED: Cannot operate on apps/my-app-qa/services/search/versions/1 because an operation is already in progress for apps/my-app-qa/services/search/versions/1 by 3458c670-76bd-42ec-a971-c0ceda7ef34f.
******************************
******************************
有没有办法在通过bash脚本进行部署时检测GCP部署错误?似乎我缺少了一些非常基础的东西,但却无法确定具体是什么。
1. var=$(gcloud --options 2>&1 >/dev/null)
var=$(cat /tmp/my-gcloud-errors)``` 此外,我从你的回复中得到了一个提示,并尝试了下面的代码,以便它只返回stderr到一个变量中,但它仍然为空。 ```{ var=$(gcloud --options 3>&2 2>&1 1>&3); } 2>&1```
- abhijeet