GoogleCloudPlatform / GoogleCloudPlatform/cloud-sql-proxy

Add example script for invoking commands against the Proxy

Aperta
#1,056 3 commenti 7 reazioni 1 assegnatario Assegnata a @hessjcg Vedi su GitHub
priority: p2 type: feature request
Lingua principale
Go
Stelle
1.4k
Fork
352
Merge medio
14h 54m
PR unite (30g)
5

Descrizione

When trying to run a script or database migration, the user currently has to
1) start the cloudsql proxy and wait for the port to open or unix domain socket to be created
2) run the command
3) stop the cloudsql proxy

The usage would be simplified if the cloudsql proxy offered an `exec` subcommand that could be used like this:
```sh
./cloudsql-proxy exec -- psql --command 'select 1;'
```
The cloudsql-proxy binary would establish the connection, then run the supplied shell command, and terminate after the termination of the command.

Similar functionality is already offered by the firestore emulator to run automated tests (e.g., `firebase emulators:exec "./my-test.sh"`, see [1]).

Without this, waiting for the cloudsql proxy to become available and killing it reliably afterwards in a typical shell script that runs in a CI/CD pipeline is a significant hassle.

[1] https://firebase.google.com/docs/functions/local-emulator#run_the_emulator_suite

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.