Search code examples
google-app-enginegoogle-cloud-platformgcloudgoogle-cloud-build

Google app engine - disable automatic start of new deployed service versions


I'm using cloud build to automatically deploy new version of app when a specific github branch is updated.

Everything works great but I'd like to deploy the new version without starting it, keeping my previous version running. I really prefer to schedule start of the new version in specific hours, but when cloud build finish the process, my new version is automatically running.

How can I change this behaviour?


Solution

  • To avoid that the new version is started you can deploy using the --no-promote flag.

    To use this flag when deploying using gcloud just need to add it to the command and deploy like this:

    gcloud app deploy --no-promote

    To implement this as part of the CD with Cloud Build then you can edit the cloudbuild.yaml to add the flag like this:

    steps:
    - name: 'gcr.io/cloud-builders/gcloud'
      args: ['app', 'deploy', '--no-promote']
      timeout: '1600s'