Reputation: 8835
I have two different outcomes when deploying a webapp to Cloud Run. Locally it works as expected. When running the build in a Bitbucket Pipeline via the .yaml build file it fails. Although the command is the same.
This is what my local try says:
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...
In Bitbucket it looks like this:
+ 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
The used versions
Google Cloud SDK 300.0.0 (Bitbucket - there was no higher image tag on Dockerhub)
Google Cloud SDK 301.0.0 (Lokal)
I am kind of lost because the error message unrecognized arguments: europe-west3-a
is not very helpful and does not make sense imho.
Upvotes: 1
Views: 575
Reputation: 75775
Your error is the following ERROR: (gcloud.run.deploy) unrecognized arguments: europe-west3-a
europe-west3-a
, an argument??? Strange... But, I made an assumption: when you call your script, you pass this argument --cluster-location=$GCLOUD_ZONE
. If $GCLOUD_ZONE
contains a space at the beginning, the string replacement is the following
--cluster-location= europe-west3-a
Which means: "--cluster-location equal empty string (nothing immediately after the equal)" and an argument alone "europe-west3-a". The reason of your error.
If you remove the =
sign, gcloud sdk takes the next printable string, remove all the space before and after and use it as parameter value.
You can also fix the issue by checking the $GCLOUD_ZONE
value and by removing all the space before the region value. And thus keep the equal sign.
Upvotes: 1