gcloud 运行 deploy 在本地工作但不在 bitbucket 管道中
gcloud run deploy works locally but not in the bitbucket pipeline
将 Web 应用程序部署到云时,我有两种不同的结果 运行。在本地它按预期工作。当 运行 通过 .yaml 构建文件在 Bitbucket 管道中构建时失败。虽然命令是一样的
这是我的本地尝试所说的:
gcloud run deploy importer-controlroom-frontend-dev --image=eu.gcr.io/myApp-cluster/importer-controlroom-frontend@sha256:976b7940b3ff62b495a946a0063de0d15d9dd1be2dbb4deab33eed94ff54d7a7 --cpu=100m --memory=64Mi --platform=gke --port=80 --timeout=10 --concurrency=1 --cluster=myApp-cluster-dev --cluster-location=europe-west3-a --connectivity=internal --namespace=dev
Deploying container to Cloud Run for Anthos service [importer-controlroom-frontend-dev] in namespace [dev] of cluster [myApp-cluster-dev]
Deploying new service...
Creating Revision...
在 Bitbucket 中它看起来像这样:
+ gcloud run deploy importer-controlroom-frontend-$DEPLOYMENT_ENV --image=eu.gcr.io/myApp-cluster/importer-controlroom-frontend:$BITBUCKET_COMMIT --cpu=100m --memory=64Mi --platform=gke --port=80 --timeout=10 --concurrency=1 --cluster=$GCLOUD_CLUSTER --cluster-location=$GCLOUD_ZONE --connectivity=internal --namespace=$DEPLOYMENT_ENV
ERROR: (gcloud.run.deploy) unrecognized arguments: europe-west3-a
To search the help text of gcloud commands, run:
gcloud help -- SEARCH_TERMS
使用过的版本
Google Cloud SDK 300.0.0 (Bitbucket - there was no higher image tag on Dockerhub)
Google Cloud SDK 301.0.0 (Lokal)
我有点迷茫,因为错误消息 unrecognized arguments: europe-west3-a
不是很有用,而且恕我直言。
你的错误如下ERROR: (gcloud.run.deploy) unrecognized arguments: europe-west3-a
europe-west3-a
,一个参数???奇怪......但是,我做了一个假设:当你调用你的脚本时,你传递了这个参数--cluster-location=$GCLOUD_ZONE
。如果$GCLOUD_ZONE
开头包含一个space,字符串替换就是下面的
--cluster-location= europe-west3-a
这意味着:“--cluster-location 等于空字符串(等号后没有任何内容)”和单独的参数“europe-west3-a”。你的错误原因。
如果去掉=
符号,gcloud sdk会取下一个可打印的字符串,去掉前后所有的space作为参数值。
您还可以通过检查 $GCLOUD_ZONE
值并删除区域值之前的所有 space 来解决此问题。从而保持等号。
将 Web 应用程序部署到云时,我有两种不同的结果 运行。在本地它按预期工作。当 运行 通过 .yaml 构建文件在 Bitbucket 管道中构建时失败。虽然命令是一样的
这是我的本地尝试所说的:
gcloud run deploy importer-controlroom-frontend-dev --image=eu.gcr.io/myApp-cluster/importer-controlroom-frontend@sha256:976b7940b3ff62b495a946a0063de0d15d9dd1be2dbb4deab33eed94ff54d7a7 --cpu=100m --memory=64Mi --platform=gke --port=80 --timeout=10 --concurrency=1 --cluster=myApp-cluster-dev --cluster-location=europe-west3-a --connectivity=internal --namespace=dev
Deploying container to Cloud Run for Anthos service [importer-controlroom-frontend-dev] in namespace [dev] of cluster [myApp-cluster-dev]
Deploying new service...
Creating Revision...
在 Bitbucket 中它看起来像这样:
+ gcloud run deploy importer-controlroom-frontend-$DEPLOYMENT_ENV --image=eu.gcr.io/myApp-cluster/importer-controlroom-frontend:$BITBUCKET_COMMIT --cpu=100m --memory=64Mi --platform=gke --port=80 --timeout=10 --concurrency=1 --cluster=$GCLOUD_CLUSTER --cluster-location=$GCLOUD_ZONE --connectivity=internal --namespace=$DEPLOYMENT_ENV
ERROR: (gcloud.run.deploy) unrecognized arguments: europe-west3-a
To search the help text of gcloud commands, run:
gcloud help -- SEARCH_TERMS
使用过的版本
Google Cloud SDK 300.0.0 (Bitbucket - there was no higher image tag on Dockerhub)
Google Cloud SDK 301.0.0 (Lokal)
我有点迷茫,因为错误消息 unrecognized arguments: europe-west3-a
不是很有用,而且恕我直言。
你的错误如下ERROR: (gcloud.run.deploy) unrecognized arguments: europe-west3-a
europe-west3-a
,一个参数???奇怪......但是,我做了一个假设:当你调用你的脚本时,你传递了这个参数--cluster-location=$GCLOUD_ZONE
。如果$GCLOUD_ZONE
开头包含一个space,字符串替换就是下面的
--cluster-location= europe-west3-a
这意味着:“--cluster-location 等于空字符串(等号后没有任何内容)”和单独的参数“europe-west3-a”。你的错误原因。
如果去掉=
符号,gcloud sdk会取下一个可打印的字符串,去掉前后所有的space作为参数值。
您还可以通过检查 $GCLOUD_ZONE
值并删除区域值之前的所有 space 来解决此问题。从而保持等号。