Necevil
Necevil

Reputation: 2912

GCloud Cloud Run Deploy "Error: ERROR: (gcloud.run.deploy) unrecognized arguments" from within Gitlab-Ci Runner Container?

This is a strange one.

A Google Cloud Run deployment run from gcloud commandline on my OSx Mac works — while the identical command run from the identical gcloud version, using a Service Account user within our Alpine based Ci/Cd Gitlab runner container / executor crashes and complains about un-recognized arguments.

With the arguments copied and pasted why is the gcloud (within Alpine gitlab runner / executor container) failing due to not recognizing the arguments where my local install works fine?

As background: We run Ci/Cd within a Gitlab Ci Runner where the docker executor that deploys our final container previously needed to use Kubectl to push that container to a GCP Managed K8s Cluster — which was expensive. So we moved the production container to Cloud Run — and it was cheaper.

Now I am working on resetting our Ci/CD deployments and ran into the above issue while attempting to deploy a container from within our GitLab Ci pipeline.

The gcloud command that works looks like this (on my local Mac)

gcloud run deploy site-production \
      --platform=managed \
      --allow-unauthenticated \
      --image=us.gcr.io/some-site-333333/site:master \
      --region=us-east1

That same (EXACT) command on the GitLab runner gets me:

ERROR: (gcloud.run.deploy) unrecognized arguments:
   --platform=managed
   --allow-unauthenticated
   --image=us.gcr.io/some-site-333333/site:master
   --region=us-east1
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS

Seems super weird — and I was pretty sure I must have had a typo or something — but the command itself was copied (and modified) from Google's own Cloud Run docs.

If I am missing something dumb let me know — until then my plan is to start shaving off optional flags to try to see which one of those parameters it's complaining about. Ideas are appreciated!

Upvotes: 0

Views: 5759

Answers (2)

Sydney
Sydney

Reputation: 12212

I had the same issue but with gcloud workflows deploy when calling it from Cloud Build. The issue is that I got a space character after \, so someting like \ instead of \.

Upvotes: 0

Try to make a one liner command like:

gcloud run deploy site-production --platform=managed --allow-unauthenticated --image=us.gcr.io/some-site-333333/site:master --region=us-east1

Upvotes: 3

Related Questions