My problem is that I want to create dev
, stage
, prod
environments by using different GCP projects.
Basically they are running the same code, just running them in different isolated environments.
I'm using gcloud app deploy
in command line to deploy app right now.
How can I efficiently deploy an app to different project?
Do I have to do gcloud init
to change my configuration of default project every time?
There must be some better practices.
Or, is there a better way for me to set up dev
... environments in the context of app engine?
Thanks.
Instead of using gcloud init
to change your configuration each time, use this code to deploy to multiple projects faster:
gcloud app deploy -q --project [YOUR_PROJECT_ID]
If your projects have similar IDs, let's say: test1
, test2
, test3
, test4
, You can deploy to the four projects with one command. Use this code:
for i in {1..4}; do gcloud app deploy -q --project test${i}; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With