Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 72 forks source link

Fix always deploy to default branch problem #160

Closed ldarren closed 5 years ago

ldarren commented 5 years ago

this PR fixes Unitech/pm2#3803 this PR doesn't break any existing api

what this PR does:

ref example following command deploy tag prod-v1.0.1 to new branch named v1.0.1

pm2 deploy production ref tags/prod-v1.0.1 v1.0.1

if the optional branch name omitted, the tag will be deploy to branch named prod-v1.0.1

the ref command can also use for branch deployment

pm2 deploy production ref develop
Unitech commented 5 years ago

Cool contribution thank you, merged!

Unitech commented 5 years ago

If I run only

$ pm2 deploy production

This does not work anymore, I'm getting:

unitech@zion:~/edve/de-project$ pm2 deploy production
--> Deploying to production environment
--> on host xxd.com
  ○ deploying origin/master
  ○ executing pre-deploy-local
  ○ hook pre-deploy
  ○ fetching updates
  ○ full fetch
Fetching origin
  ○ checkout origin/master to master
fatal: A branch named 'master' already exists.

  git checkout failed

Deploy failed
1
Unitech commented 5 years ago

I've unmerged the PR as long as it's blocking our deployments systems.

If you could make sure that:

pm2 deploy production setup
pm2 deploy production

Work as expected, we will be able to merge it back. Feel free to re-open a PR as that one can't be opened back. Thank you!

Unitech commented 5 years ago

works perfectly. sorry for the late answer, merged