tl;dr version: Is Berkshelf able to resolve recursive dependencies within Git-based cookbooks and if yes - how?
I try to manage my Chef cookbook dependencies with Berkshelf. The cookbooks are all stored in internal Git repositories. The dependencies are as follows:
env_dockerhub_dev
>>depends on>> app_dockerhub
>>depends on>> app_docker
The main Berksfile in my project looks like this:
source "https://supermarket.chef.io"
cookbook "env_dockerhub_dev", git: "git@URL_TO_GIT_SERVER/chef_env_dockerhub_dev.git"
The env_dockerhub_dev
cookbook has a metadata.rb
like this:
name 'env_dockerhub_dev'
...
depends 'app_dockerhub'
depends 'base_ubuntu'
and a Berksfile
like this:
source "https://supermarket.chef.io"
cookbook "app_dockerhub", git: "git@URL_TO_GIT_SERVER/chef_app_dockerhub.git"
cookbook "base_ubuntu", git: "git@URL_TO_GIT_SERVER/chef_base_ubuntu.git"
When I now run berks install
I get the following error message:
Resolving cookbook dependencies...
Fetching 'env_dockerhub_dev' from git@URL_TO_GIT_SERVER/chef_env_dockerhub_dev.git (at master)
Fetching cookbook index from https://supermarket.chef.io...
Unable to satisfy constraints on package app_dockerhub, which does not exist, due to solution constraint (env_dockerhub_dev = 0.1.0). Solution constraints that may result in a constraint on app_dockerhub: [(env_dockerhub_dev = 0.1.0) -> (app_dockerhub >= 0.0.0)]
Missing artifacts: app_dockerhub,base_ubuntu
Demand that cannot be met: (env_dockerhub_dev = 0.1.0)
Unable to find a solution for demands: env_dockerhub_dev (0.1.0)
I can fix the problem, when I add all the Git URLs for all my internal cookbooks into the "main" Berksfile (the Berksfile in the root of my project) like this:
source "https://supermarket.chef.io"
# the main cookbook
cookbook "env_dockerhub_dev", git: "git@URL_TO_GIT_SERVER/chef_env_dockerhub_dev.git"
# the cookbooks that are "recursively"
cookbook "app_dockerhub", git: "git@gURL_TO_GIT_SERVER/chef_app_dockerhub.git"
cookbook "app_docker", git: "git@URL_TO_GIT_SERVER/chef_app_docker.git"
Anyhow - I think this should not be the solution for this problem.
Thx a lot for your help!