Deploy a Cloud Run instance with add-cloudsql-instances
Pierre-Alexandre35 opened this issue · comments
TL;DR
Hello,
I am deploying a cloud-run app that is connected to a Cloud SQL instance. Cloud Run has a built-in feature that allows to directly connect to a Cloud SQL instance using TCP socket.
From my machine, this commands works perfectly, the cloud run app is deployed correctly:
gcloud run deploy backend --image=gcr.io/ecstatic-motif-393807/backend:1.0.0 --port=8000 --platform managed --allow-unauthenticated --region=europe-west1 \
--add-cloudsql-instances ecstatic-motif-393807:us-central1:travian-db \
--set-env-vars INSTANCE_UNIX_SOCKET="/cloudsql/ecstatic-motif-393807:us-central1:travian-db" \
--set-env-vars INSTANCE_CONNECTION_NAME="ecstatic-motif-393807:us-central1:travian-db" \
--set-env-vars DB_NAME="quickstart_db" \
--set-env-vars DB_USER="pierre" \
--set-env-vars DB_PASS="123456"
When I am trying to integrate this scrip to my github-actions CD, I am getting an error. It seems that only the last 5 arguments are unrecognized and therefore a version issue?
Expected behavior
No response
Observed behavior
No response
Action YAML
name: Back End Deployment on Cloud Run
on:
push:
branches: [ "main" ]
jobs:
# To build the project
build-back:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./travian/backend/
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checking out code
uses: actions/checkout@v3
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v1.1.1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Fix Auth
run: yes | gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS"
- name: Deploy to Cloud Run
run: gcloud run deploy backend --image=gcr.io/ecstatic-motif-393807/backend:1.0.0 --port=8000 --platform managed --allow-unauthenticated --region=europe-west1 \
--add-cloudsql-instances ecstatic-motif-393807:us-central1:travian-db \
--set-env-vars INSTANCE_UNIX_SOCKET="/cloudsql/ecstatic-motif-393807:us-central1:travian-db" \
--set-env-vars INSTANCE_CONNECTION_NAME="ecstatic-motif-393807:us-central1:travian-db" \
--set-env-vars DB_NAME="quickstart_db" \
--set-env-vars DB_USER="pierre" \
--set-env-vars DB_PASS="123456"
Log output
Run gcloud run deploy backend --image=gcr.io/ecstatic-motif-393807/backend:1.0.0 --port=8000 --platform managed --allow-unauthenticated --region=europe-west1 \ --add-cloudsql-instances ecstatic-motif-393807:us-central1:travian-db \ --set-env-vars INSTANCE_UNIX_SOCKET="/cloudsql/ecstatic-motif-393807:us-central1:travian-db" \ --set-env-vars INSTANCE_CONNECTION_NAME="ecstatic-motif-393807:us-central1:travian-db" \ --set-env-vars DB_NAME="quickstart_db" \ --set-env-vars DB_USER="pierre" \ --set-env-vars DB_PASS="123456"
ERROR: (gcloud.run.deploy) unrecognized arguments:
--add-cloudsql-instances
ecstatic-motif-393807:us-central1:travian-db
--set-env-vars
INSTANCE_UNIX_SOCKET=/cloudsql/ecstatic-motif-393807:us-central1:travian-db
INSTANCE_CONNECTION_NAME=ecstatic-motif-393807:us-central1:travian-db
DB_NAME=quickstart_db
DB_USER=pierre
DB_PASS=123456
To search the help text of gcloud commands, run:
gcloud help -- SEARCH_TERMS
Error: Process completed with exit code 2.
### Additional information
_No response_
Where are you calling google-github-actions/setup-gcloud
? The version of gcloud that is pre-installed on the GitHub Manager runners tends to be very outdated and probably does not support that flag yet.