Giter Club home page Giter Club logo

Comments (11)

mal avatar mal commented on June 3, 2024

Ran into this recently when testing deploys on ubuntu 14.04, seems the issue arose when git learnt the --single-branch flag in 1.7.10 and the default behaviour changed. The most recent git package on 12.04 was 1.7.9 so we'd never run into the issue there.

Your suggestion fixes the initial deploy, but if the next deploy switches branch you run into the same issue. I think the flag to use is --no-single-branch which ensures you get the tip of all current branches which I believe was standard git behaviour prior to git 1.7.10. Unfortunately, because that flag doesn't exist in versions prior to that, there likely needs to be some git version detection to avoid breaking deploy for machines still using old version of git.

from chef.

sersut avatar sersut commented on June 3, 2024

@vitaliel thanks for the issue. Would be great if you can take a stab at adding the additional parameter for -b branch_name. Let us know if you need some pointers to get started.

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

Any update on this?

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

Anyone have a suggested workaround for this issue, given i have several cookbooks we use to deploy code internally that are broken by this bug.

from chef.

mal avatar mal commented on June 3, 2024

You can work around in the short term with shallow_clone false, your deploy will take longer, but it mitigates the problem. Obviously depending on the size of the repo in question, this may or may not be viable.

The more hardcore solution is a total hack; works by monkey patching the resource to inject the necessary switch. However be warned this will break deploys on any machine using a version of git prior to 1.7.10. If you're happy with that you should be able to create an rb file in your cookbook's libraries directory containing:

class Chef
  class Resource
    class Deploy < Chef::Resource
      def depth
        @shallow_clone ? "5 --no-single-branch" : nil
      end
    end
  end
end

You might need to play with that a bit as I only gave it a cursory test a month or so ago and just rewrote it from memory.

P.S. You could probably add some version check conditional to the hack if you need to support older git versions.

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

Thanks! that almost worked, with a small tweek i got something that gets me out of this bind until a better solution is found!

class Chef
  class Resource
    class Deploy < Chef::Resource
      def depth
        if node[:platform_version].to_i  >= 14.04 && node[:platform] == "ubuntu"
          @shallow_clone ? "--depth 5 --no-single-branch" : nil
        end
      end
    end
  end
end

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

Has a official fix for this issue been identified? As a side note the fix above works great for simple cookbooks, however on a more complex cookbook, with a non default.rb recipe this fix seems to fail.

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

Any idea of the priority of this?

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

based on the lack of response I'm going to guess opscode is not going to fix this

from chef.

randomcamel avatar randomcamel commented on June 3, 2024

@neallawson Fixed in master.

from chef.

DoctorOgg avatar DoctorOgg commented on June 3, 2024

@randomcamel Thank You! this will make my life much easer!!!!

from chef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.