fix multiple deployment due to Bitbucket retry

Fix issues below.   See detail in each issue how we fix it.

#505 Fix condition that leaves some deployment with the string 'Fetching changes'
#501 Second deployment happens when /deploy is called from Bitbucket