Search code examples
chef-infraberkshelf

How to use always newest cookbook while some other keep locking with Berkshelf


I have a Berksfile like this:

source "https://api.berkshelf.com"

cookbook 'ruby_build'
cookbook 'rbenv', github: 'fnichol/chef-rbenv'
cookbook 'foo', git: 'git@bitbucket.org:ironsand/cookbook-foo.git'

After knife solo cook node, Berksfile.lock is created and lock the version of cookbooks.

I want to use latest cookbook for own cookbook(foo), and lock the version for cookbook created by others(rbenv,ruby_build).

I couldn't find out how to do it. does anyone know can I do it?


Solution

  • you can specify your cookbook versions in the Berksfile. Or, in the case of the cookbooks that you are giving a git repo for, you can specify the revision to pull.

    source "https://api.berkshelf.com"
    
    cookbook 'ruby_build', '= 4.0.2'
    cookbook 'rbenv', github: 'fnichol/chef-rbenv', tag: 'some_Tag'
    cookbook 'foo', git: 'git@bitbucket.org:ironsand/cookbook-foo.git', :branch 'master'
    

    you can also use :ref 'some_git_hash_for_ref' at if you want a specific hash rather than a tag or branch.