Hi I am trying to make a php artisan migrate with my script with a cloud sql proxy connection. The sql proxy connection working fine but when it launch my command it fail with the error
---------- CONNECT CLOUDSQL ----------
cloud_sql_proxy is running.
Connections: ****:europe-west1:***-bdd.
---------- EXECUTE COMMAND ----------
/var/www/scripts-cloud/migrate.sh
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for /cloudsql/*** failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = scorecard and table_name = migrations and table_type = 'BASE TABLE')
here my code
- name: "gcr.io/google-appengine/exec-wrapper"
entrypoint: 'bash'
args:
- -c
- |
/buildstep/execute.sh \
-i europe-west1-docker.pkg.dev/$PROJECT_ID/$$SERVICE_NAME/api \
-e DB_CONNECTION=mysql \
-e DB_SOCKET=$$DB_HOST \
-e CLOUD_SQL_CONNECTION_NAME=$$PROJECT_ID:$$PROJECT_REGION:$$PROJECT_INSTANCE \
-e DB_DATABASE=$$DB_DATABASE \
-e DB_USERNAME=$$DB_USERNAME \
-e DB_PASSWORD=$$DB_PASSWORD \
-e EMAIL_SUPER_ADMIN=$$EMAIL_SUPER_ADMIN \
-e PWD_SUPER_ADMIN=$$PWD_SUPER_ADMIN \
-s $$PROJECT_ID:$$PROJECT_REGION:$$PROJECT_INSTANCE \
/var/www/scripts-cloud/migrate.sh
secretEnv: ['DB_PASSWORD', 'DB_DATABASE', 'DB_USERNAME', 'DB_HOST', 'PROJECT_ID', 'PROJECT_REGION', 'PROJECT_INSTANCE', 'SERVICE_NAME', 'EMAIL_SUPER_ADMIN', 'PWD_SUPER_ADMIN']
If I launch a connection manually with a command cloud proxy
./cloud-sql-proxy --port 3307 ****:europe-west1:***-bdd
I can connect and use the bdd locally and launching everything I want
Did I forget something?
THanks
I reverify all the code, replace manually, launching locally
Sharing this as a community wiki for the benefit of others
As mentioned by @shinzo94