Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcloud run deploy lacks of options #538

Closed
fbukevin opened this issue Mar 21, 2022 · 3 comments
Closed

gcloud run deploy lacks of options #538

fbukevin opened this issue Mar 21, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@fbukevin
Copy link

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 setup-cloud@v0 seems different than current official gcloud run[1]

setup-cloud@v0

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/setup-gcloud@v0
        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

@fbukevin fbukevin added the bug Something isn't working label Mar 21, 2022
@verbanicm
Copy link
Member

@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
Copy link
Member

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
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants