How to manually deploy direct from Bitbucket to Go

2019-02-28 13:34发布

问题:

To manually deploy from a changed source on a Bitbucket repository (named trackfind) to a Google App Engine app (ID trackfind-1) , I'm doing this:

1 Go to https://console.cloud.google.com/home/dashboard?authuser=0&project=trackfind-1

2 Click Activate Google Cloud Shell:

3 Enter rm -rf trackfind

4 Enter git clone -b master https://chrisjj@bitbucket.org/chrisjj/trackfind.git

5 Enter appcfg.py -V 1 -A trackfind-1 update trackfind

6 Go to trackfind-1.appspot.com and verify changes are in place.

I'm sure there must be a quicker, direct way, e.g. avoiding cloning the repository each time. (I'm not interested in indirect methods e.g. using a local machine or an extra VM to run e.g. a third-party tool such as Jenkins.)

What is that way?

Note: I edited 3 from https://bitbucket.org/chrisjj/trackfind to https://chrisjj@bitbucket.org/chrisjj/trackfind.git , which avoids a prompt for the username.

回答1:

You could speedup things a bit by re-using the existing trackfind repository:

  1. Enter cd trackfind

  2. Enter git checkout master; git pull

This will only pull the delta changes since the last deployment, which can be significantly faster than re-pulling the entire repository from scratch, especially if it's a large repository and/or it has a long change history.