Pushkar
Pushkar

Reputation: 571

Berkshelf does not download dependencies for cookbook in git

I have three cookbooks 'A', 'B' and 'C'. Each cookbooks lives in it's own repo.

Cookbook 'B' depends on 'A' and I have entry for cookbook 'A' Berksfile, with source set to repo url

Cookbook 'C' depends on 'B' and I have entry for cookbook 'B' Berksfile, with source set to repo url

However upon running berks vendor on Berksfile of cookbook 'C', I see that berkshelf doesn't download cookbook 'A'

What am I doing wrong here

Upvotes: 3

Views: 810

Answers (1)

jssnirmal
jssnirmal

Reputation: 78

The dependencies for your cookbook should be listed in the cookbook's metadata.rb file.

In your use case here, if cookbook A is dependent on cookbook B, you should have the following line in the metadata.rb file of your cookbook A.

depends 'B'

Now, coming to your Berksfile, the source is for the community cookbooks listed on the supermarket, unless you have your own supermarket instance standing somewhere. For the cookbooks that are not on supermarket use the "cookbook" in your Berksfile to list your dependency as shown in the example below:

source 'https://supermarket.getchef.com'

metadata

cookbook 'B', git:'http://<your_domain>/project/B', tag: 'some_tag'

Berkshelf handles cookbook dependencies based on the dependencies listed in your cookbook's metadata.rb.

Upvotes: 2

Related Questions