Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there's no way to monitor 2 different branches of the same repo #2

Open
aethernet opened this issue Dec 27, 2013 · 7 comments
Open

Comments

@aethernet
Copy link

ie : master & staging

@mattesser
Copy link

I also ran into this issue. Is there a quick way to change the code to accommodate this?

@lkwdwrd
Copy link
Owner

lkwdwrd commented Mar 10, 2014

I'd be curious to know the usecase/workflow for this when it comes to deployment. Are you talking about deploying two branches to two locations, or two branches to the same location and basically have it switch branches when you commit to one or the other?

In general for a staging site, I would recommend deploying a staging brach, doing development in feature branches, and when a feature is fully baked, merging just that feature into master to push it to production.

@mattesser
Copy link

For me the workflow would be this...

Two branches, develop and master.

If I work on my code, it is primarily in develop. Commit something, push it to Hit or Bitbucket and then run the post hook that calls this PHP script and works as advertised and places the code into a folder on my server that has both stage and production on it. I then use your script to run rsync to move the files into place. This part works great.

I then tried to add a different branch for the same project (master) and have it download to a different location and run rsync to move it to the production location but having two names the same in your array causes it to break. Could there be a way to define two different locations and two different post process scripts in your deploy script for the same project?

@lkwdwrd
Copy link
Owner

lkwdwrd commented Mar 15, 2014

I'll see if I can come up with a way to allow two branches for the same project to deploy to two locations. That does make sense, probably some kind of conflict with the way the config array is set up. I've got a quite a few things going on right now, so writing this may take me a little while to get to.

@francislavoie
Copy link

I'd like to +1 this as well, I have a staging branch and a production branch. My staging site is a subdirectory of my production, so I have production in /var/www/html and staging in /var/www/html/staging. They use the same repo. I'm thinking instead of using a assoc array, you could just use an array of configs and have the repo name in that array.

@jazzmind
Copy link

I've come up with a a fix for this. I've forked the repo and will be testing the fix over the next day or so.

Basically, the fix is twofold: "branch" in the config can optionally take an associative array of branch names and paths. If it is an array, and there's a match, then it uses the matching path.

The second part to the fix is letting the match be a bit lazy - so any branch that starts with what is given in the config will match. E.g. "branch" => "release/v1.1" will match "release/v1.1.1" as well... did this because I'm fine with Patch releases going to the same directory. Sometimes I'm even fine with minor versions and just want to keep different deploy configs for major versions...

https://github.com/jazzmind/git-deploy

@francislavoie
Copy link

https://github.com/francislavoie/git-deploy

I made my own implementation as well, I instead modified it to use a "repo nickname" for the assoc array key, and the actual repo name is within the array. My implementation is only done for Bitbucket because I'm only using bitbucket for my current project.

It might be a little convoluted of a change, but it's what worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants