gcloud run deploy lacks of options

This issue has been tracked since 2022-03-21.

TL;DR

When I configured workflow yaml and expecting it automatically run gcloud run deploy command, an error occured says that some options, such as --source , --vpc-connector, are not recognized.

I found that the options of gcloud run in [email protected] seems different than current official gcloud run[1]

[email protected]

Usage: gcloud run deploy [[SERVICE] --namespace=NAMESPACE] --image=IMAGE [optional flags]
  optional flags may be  --add-cloudsql-instances | --allow-unauthenticated |
                         --args | --async | --clear-cloudsql-instances |
                         --clear-config-maps | --clear-env-vars |
                         --clear-labels | --clear-secrets | --cluster |
                         --cluster-location | --command | --concurrency |
                         --connectivity | --context | --cpu | --help |
                         --kubeconfig | --labels | --max-instances | --memory |
                         --min-instances | --namespace | --platform | --port |
                         --region | --remove-cloudsql-instances |
                         --remove-config-maps | --remove-env-vars |
                         --remove-labels | --remove-secrets |
                         --revision-suffix | --service-account |
                         --set-cloudsql-instances | --set-config-maps |
                         --set-env-vars | --set-secrets | --timeout |
                         --no-traffic | --update-config-maps |
                         --update-env-vars | --update-labels |
                         --update-secrets | --use-http2

official

gcloud run deploy [[SERVICE] --namespace=NAMESPACE] [--args=[ARG,...]]
        [--async] [--command=[COMMAND,...]] [--concurrency=CONCURRENCY]
        [--cpu=CPU] [--ingress=INGRESS; default="all"]
        [--max-instances=MAX_INSTANCES] [--memory=MEMORY]
        [--min-instances=MIN_INSTANCES]
        [--platform=PLATFORM; default="managed"] [--port=PORT]
        [--service-account=SERVICE_ACCOUNT] [--tag=TAG] [--timeout=TIMEOUT]
        [--no-traffic] [--[no-]use-http2]
        [--clear-env-vars | --env-vars-file=FILE_PATH
          | --set-env-vars=[KEY=VALUE,...]
          | --remove-env-vars=[KEY,...] --update-env-vars=[KEY=VALUE,...]]
        [--clear-labels | --remove-labels=[KEY,...] --labels=[KEY=VALUE,...]
          | --update-labels=[KEY=VALUE,...]]
        [--clear-secrets | --set-secrets=[KEY=VALUE,...]
          | --remove-secrets=[KEY,...] --update-secrets=[KEY=VALUE,...]]
        [--connectivity=CONNECTIVITY --clear-config-maps
          | --set-config-maps=[KEY=VALUE,...] | --remove-config-maps=[KEY,...]
          --update-config-maps=[KEY=VALUE,...]]
        [--image=IMAGE | --source=SOURCE]
        [--[no-]allow-unauthenticated --breakglass=JUSTIFICATION
          --clear-vpc-connector --[no-]cpu-throttling
          --revision-suffix=REVISION_SUFFIX --vpc-connector=VPC_CONNECTOR
          --vpc-egress=VPC_EGRESS
          --add-cloudsql-instances=[CLOUDSQL-INSTANCES,...]
          | --clear-cloudsql-instances
          | --remove-cloudsql-instances=[CLOUDSQL-INSTANCES,...]
          | --set-cloudsql-instances=[CLOUDSQL-INSTANCES,...]
          --binary-authorization=POLICY
          | --clear-binary-authorization --clear-key
          | --key=KEY --clear-post-key-revocation-action-type
          | --post-key-revocation-action-type=POST_KEY_REVOCATION_ACTION_TYPE]
        [--region=REGION
          | --cluster=CLUSTER --cluster-location=CLUSTER_LOCATION
          | --context=CONTEXT --kubeconfig=KUBECONFIG] [GCLOUD_WIDE_FLAG ...]

[1] https://cloud.google.com/sdk/gcloud/reference/run/deploy#--source

Expected behavior

No response

Observed behavior

No response

Action YAML

# Setup gcloud CLI
      # https://github.com/google-github-actions/setup-gcloud
      - uses: google-github-actions/[email protected]
        with:
          version: '286.0.0'
          service_account_email: ${{ secrets.GCP_SA_EMAIL }}
          service_account_key: ${{ secrets.GCP_SA_KEY }}
          project_id: ${{ secrets.GCP_PROJECT_ID }}
          export_default_credentials: true
          
      # Print gcloud info
      - name: Info
        run: gcloud info

      # Deploy to cloud run
      - name: Deploy
        run: |-
          gcloud run deploy server 
          --source . \
          --set-env-vars DATABASE_URL=mysql://root:[email protected]:3306/parachute \
          --vpc-connector=projects/parachute-344120/locations/us-east4/connectors/parachute-server \
          --region=us-east4

Log output

Run gcloud run deploy server --source . \
  gcloud run deploy server --source . \
  --set-env-vars DATABASE_URL=***10.96.176.3:3306/mydb \
  --vpc-connector=projects/***/locations/us-east4/connectors/server \
  --region=us-east4
  shell: /usr/bin/bash -e ***0***
  env:
    CLOUDSDK_METRICS_ENVIRONMENT: github-actions-setup-gcloud
    GCLOUD_PROJECT: ***
    GOOGLE_APPLICATION_CREDENTIALS: /home/runner/work/server/server/9bca1a4caa2478ef5a970bfa
    GOOGLE_GHA_CREDS_PATH: /home/runner/work/server/server/9bca1a4caa2478ef5a970bfa
ERROR: (gcloud.run.deploy) unrecognized arguments:
  --source
  .
  --vpc-connector=projects/***/locations/us-east4/connectors/server (did you mean '--connectivity'?)
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
Error: Process completed with exit code 2.

Additional information

No response

verbanicm wrote this answer on 2022-03-21

@fbukevin You are using an old version of the gcloud sdk by setting the version: '286.0.0' property. Can you remove the version flag to use the latest?

Also, we have an action specific to deploying Cloud Run. You can check it out here.

NOTE: You can use the --flags property to add --vpc-connector for the Cloud Run action.

verbanicm wrote this answer on 2022-03-21

Also, if you want to keep a static version with gcloud, you will need at least version 354.0.0 to use the --source command with gcloud (prior to this you would need the beta command).

You can see the release notes here: https://cloud.google.com/sdk/docs/release-notes#35400_2021-08-24

fbukevin wrote this answer on 2022-03-21

@verbanicm
Ah, thanks for reminding me. I thought that replacing @master with v0 makes it use the latest version.
I fixed it by replacing version.
I will consider using deploy-cloudrun.
Thanks for your help!

More Details About Repo
Owner Name google-github-actions
Repo Name setup-gcloud
Full Name google-github-actions/setup-gcloud
Language TypeScript
Created Date 2019-11-05
Updated Date 2023-03-23
Star Count 1505
Watcher Count 65
Fork Count 548
Issue Count 11

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date