I guess this may have been the source of both my confusion and problem. I was using the git repo as a canonical source in order to upload the main cookbook and it's dependencies to both our chef servers. This wss used by our Jenkins install ti do that on commit/release. So the confusion came when I found myself having to input the version twice, once in the berksfile and again in the metadata file.
Hey Torben,Yeah you'd need to specify the branch that you want to use. I can see why it would seem to make sense to determine "the best branch to use", but there's a problem with that. Technically version 1.0.0 may exist as many, many, more commits than just the very first SHA where the metadata file contains the numbers "1.0.0". This is because artifacts are not "finalized" when they exist in our Git repositories, and this is another reason why it is strongly suggested to avoid using the Git source in a Berksfile to manage each of your cookbooks.It is a much better approach to instead point to an artifact server that contains finalized artifacts. In this case the Chef server is actually an artifact server containing finalized artifacts. Berkshelf actually by default freezes cookbooks on upload to further enforce this idea.Since there is at any one time more than one version of a cookbook as identified by the string present in the metadata.rb, it is impossible to properly identify the "best branch to use".On Wednesday, May 22, 2013 at 2:33 PM, Torben Knerr wrote:
Hey Jamie,picking up your last example:site :opscodechef_api :Configcookbook 'my-app', github: 'RiotGames/my-app'cookbook 'some-dependency', github: 'RiotGames/some-dependency'If RiotGames/my-app/metadata.rb says:depends 'some-dependency', '= 1.0'...then Berkshelf would still try to use the HEAD rev in the master branch, right?So if `some-dependency` lives in a git repo but not on the community site (e.g. if you maintain a fork of a community cookbook) and you want to get v1.0, then you would have to specify the branch explicitly in that Berksfile, i.e.:cookbook 'some-dependency', github: 'RiotGames/some-dependency', branch: 'v1.0'Wouldn't it make sense if Berkshelf per convention tries to detect the "best branch to use"?In the above example '= 1.0' this is simple, its actaully a bit more complicated due to the various version specifiers (e.g. '=> 1.0', '~>1.1', etc)Cheers,TorbenOn Wed, May 22, 2013 at 10:15 PM, Jamie Winsor < " target="_blank"> > wrote:
Hey Mark,Given the Berksfile:site :opscodecookbook '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 :opscodechef_api :configcookbook '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 :opscodechef_api :Configcookbook '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.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.