# Problem with deploy\_branch

**URL:** <https://discourse.chef.io/t/problem-with-deploy-branch/4499>\
**Category:** Chef Infra (archive)\
**Created:** [September 26, 2013, 1:44am UTC](https://discourse.chef.io/t/problem-with-deploy-branch/4499 "2013-09-26T01:44:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jennifer\_Fountain](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jennifer_fountain/32/63_2.png) [@Jennifer\_Fountain](https://discourse.chef.io/u/Jennifer_Fountain)\
**Post date:** [September 26, 2013, 1:44am UTC](https://discourse.chef.io/t/problem-with-deploy-branch/4499/1 "2013-09-26T01:44:58Z")

</div>

Here is the recipe I am having problems with:

deploy\_branch node[:app][:frontend][:directory] do  
repository node[:app][:git\_repository]  
ssh\_wrapper node[:app][:git\_ssh\_wrapper]  
branch node[:app][:branch]  
enable\_submodules true

user 'app’  
group ‘nginx’

create\_dirs\_before\_symlink.clear  
purge\_before\_symlink %w{log}  
symlink\_before\_migrate.clear  
symlinks({‘log’ =\> ‘log’})

action :deploy  
end

It is creating a copy of repository\_cache but seems to be keeping older files and causing code conflicts and issues. I am running nginx and php\_fpm.

Is anyone aware of any issues with what I am doing or is there an known issue? Anyone to disable repo\_cache?

Thanks for any help!  
Jenn

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [September 26, 2013, 5:27pm UTC](https://discourse.chef.io/t/problem-with-deploy-branch/4499/2 "2013-09-26T17:27:45Z")

</div>

On Wednesday, September 25, 2013 at 6:44 PM, Jenn Fountain wrote:

> Here is the recipe I am having problems with:
> 
> deploy\_branch node[:app][:frontend][:directory] do  
> repository node[:app][:git\_repository]  
> ssh\_wrapper node[:app][:git\_ssh\_wrapper]  
> branch node[:app][:branch]  
> enable\_submodules true
> 
> user 'app'  
> group 'nginx'
> 
> create\_dirs\_before\_symlink.clear  
> purge\_before\_symlink %w{log}  
> symlink\_before\_migrate.clear  
> symlinks({'log' =\> 'log'})
> 
> action :deploy  
> end
> 
> It is creating a copy of repository\_cache but seems to be keeping older files and causing code conflicts and issues. I am running nginx and php\_fpm.  
> Can you be more specific? Is Chef giving you an error message? What behavior are you expecting, and how is it different from the behavior you're observing?

> Is anyone aware of any issues with what I am doing or is there an known issue? Anyone to disable repo\_cache?  
> If you don't need all of the features of the deploy resource, you can roll you own deployment by using the git resource directly.

> Thanks for any help!  
> Jenn

--  
Daniel DeLeo

---

<div class="post-metadata">

**Author:** ![Jennifer\_Fountain](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jennifer_fountain/32/63_2.png) [@Jennifer\_Fountain](https://discourse.chef.io/u/Jennifer_Fountain)\
**Post date:** [September 26, 2013, 6:58pm UTC](https://discourse.chef.io/t/problem-with-deploy-branch/4499/3 "2013-09-26T18:58:42Z")

</div>

On Sep 26, 2013, at 1:27 PM, Daniel DeLeo [dan@kallistec.com](mailto:dan@kallistec.com) wrote:

> On Wednesday, September 25, 2013 at 6:44 PM, Jenn Fountain wrote:
> 
> > Here is the recipe I am having problems with:
> > 
> > deploy\_branch node[:app][:frontend][:directory] do  
> > repository node[:app][:git\_repository]  
> > ssh\_wrapper node[:app][:git\_ssh\_wrapper]  
> > branch node[:app][:branch]  
> > enable\_submodules true
> > 
> > user 'app'  
> > group 'nginx'
> > 
> > create\_dirs\_before\_symlink.clear  
> > purge\_before\_symlink %w{log}  
> > symlink\_before\_migrate.clear  
> > symlinks({'log' =\> 'log'})
> > 
> > action :deploy  
> > end
> > 
> > It is creating a copy of repository\_cache but seems to be keeping older files and causing code conflicts and issues. I am running nginx and php\_fpm.  
> > Can you be more specific? Is Chef giving you an error message? What behavior are you expecting, and how is it different from the behavior you're observing?

We removed certain modules in the .gitmodules file but they still existed in the new revisions and existed in cache-copy.

> > Is anyone aware of any issues with what I am doing or is there an known issue? Anyone to disable repo\_cache?  
> > If you don't need all of the features of the deploy resource, you can roll you own deployment by using the git resource directly.

I do like the features - symlink, etc. I would like to continue using it. Open for suggestion now.

> > Thanks for any help!  
> > Jenn
> 
> --  
> Daniel DeLeo

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [September 26, 2013, 7:07pm UTC](https://discourse.chef.io/t/problem-with-deploy-branch/4499/4 "2013-09-26T19:07:15Z")

</div>

On Thursday, September 26, 2013 at 11:58 AM, Jenn Fountain wrote:

> > > It is creating a copy of repository\_cache but seems to be keeping older files and causing code conflicts and issues. I am running nginx and php\_fpm.  
> > > Can you be more specific? Is Chef giving you an error message? What behavior are you expecting, and how is it different from the behavior you're observing?
> 
> We removed certain modules in the .gitmodules file but they still existed in the new revisions and existed in cache-copy.

Git submodules are generally a huge headache. As you can see here: [GitSubmoduleTutorial - Git SCM Wiki](https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial) (at the bottom) git doesn't automatically remove them, they become untracked files. So you'll need custom code to remove them, probably in one of the deploy resource callbacks. You may be able to accomplish this using `git clean` but that could remove files you want to keep. You probably will need to experiment a bit to find the best approach for your application and team.

--  
Daniel DeLeo
