[chef] Re: Berksfile question


Chronological Thread 
  • From: Jamie Winsor < >
  • To:
  • Subject: [chef] Re: Berksfile question
  • Date: Wed, 22 May 2013 13:15:32 -0700

Hey Mark,

Given the Berksfile:

site :opscode
cookbook 'my-app', github: 'RiotGames/my-app'

This will point to HEAD of the Git repository located at that Github repo. It will reflect on the metadata.rb of that file and use one of the 'default sources' to find, and download, any cookbooks found in the metadata of 'my-app'. Let's say that 'my-app' depended on the NGINX cookbook. Berkshelf would go out to the Opscode community site to find the cookbook because you have only one default source, 'site :opscode'.

Given the Berksfile:

site :opscode
chef_api :config

cookbook 'my-app', github: 'RiotGames/my-app'

Now we have two default sources. First we will go out to the community site and attempt to find the version of the NGINX cookbook that 'my-app' depends on. If it is not found then we will go to your configured Chef Server using the credentials in  your Berkshelf configuration (or Knife configuration if you don't have a Berkshelf configuration) and attempt to find it there.

Let's say that 'my-app' depended on a cookbook which is not found on your Chef server or on the Community site, or let's say you want to pull this other dependency that out of Git. You would then have to explicitly list the location of that cookbook in your Berksfile. Here is an example:

site :opscode
chef_api :Config

cookbook 'my-app', github: 'RiotGames/my-app'
cookbook 'some-dependency', github: 'RiotGames/some-dependency'

It is strongly suggested that you avoid managing all of your dependencies through Git and instead rely on the second example I have given you. Instead upload those cookbooks into your Chef Server and allow the chef_api default source to find them.

-- 
Jamie Winsor
@resetexistence
https://github.com/reset

On Wednesday, May 22, 2013 at 6:32 AM, Mark Pimentel wrote:

If I specify a git location without a branch and the metadata.rb specifies the version required, does berkshelf pull master and check the version in that dependencies' metadata?

If I want to pull a specific tag, I understand you would have to specify branch: "1.0.0" in berks but then also in metadata?  That seems somewhat redundant.  

Am I missing something?

--
Thanks,

Mark




Archive powered by MHonArc 2.6.16.

§