I work on multiple appengine projects in any given week. i.e. assume multiple clients. Earlier I could set application
in app.yaml
. So whenever I did appcfg.py update....
it would ensure deployment to the right project.
When deploying, the application variable throws an error with gcloud deploy
. I had to use
gcloud app deploy --project [YOUR_PROJECT_ID]
. So what used to be a directory level setting for a project, is now going into our build tooling. And missing out that simple detail can push a project code to the wrong customer.
i.e. if I did gcloud config set project proj1
and then somehow did a gcloud app deploy
in proj2, it would deploy to proj1. Production deployments are done after detailed verification on the build tools and hence it is less of an issue there because we still use the --project
flag.
But its hard to do similar stuff on the development environment. dev_appserver.py
doesn't have a --project
flag.
When starting dev_appserver.py
I've to do gcloud config set project <project-id>
before I start the server. This is important when I using stuff like PubSub or GCS (in dev topics or dev buckets).
Unfortunately, missing out a simple configuration like setting a project ID in a dev environment can result into uploading blobs/messages/etc into the wrong dev gcs bucket or wrong dev pubsub topic (not using emulators). And this has happened quite a few times especially when starting new projects.
I find the above solutions as hackish-workarounds. Is there a good way to ensure that we do not deploy or develop in a wrong project when working from a certain directory?