If you use berks to download/upload your vendor cookbooks, how do you get it to use the environment constraints?
Thanks!
If you use berks to download/upload your vendor cookbooks, how do you get it to use the environment constraints?
Thanks!
You can use ‘Berks apply “env-name”’ but do it from within your cookbook folder.
Thank you for feedback!
Will this apply to the chef server or the berkfile.lock? So, it reads the env settings from chef (or the json file) and applies to the lockfile?
Berkshelf doesn't read Chef Environments. If you need to restrict cookbooks to particular versions when using berks, you need to put that in the Berksfile. Where environments come into play is on the nodes. Chef Server and Chef Client don't understand berkshelf concepts like the lockfile. So you use environments to lock down the cookbooks that your nodes used to the same versions you developed/tested with.
In general, what you want is to have a development flow like:
community cookbooks and in-house library cookbooks -> local dev w/ berks for application cookbooks -> upload cookbooks and generate an environment to lock down cookbook versions
You might also want to check out Policyfiles, which are like lock files that the Chef Server and Chef Client do understand (so you no longer need to use environments at all).