The world of Chef cookbook development and testing has improved a ton in the last year or two. We can be far more confident in our configuration quality since we run them via Test Kitchen using our internal custom AMIs.
At this point, Berkshelf can't directly index cookbooks hosted in chef-server and a Berkshelf API server is required. We had need for multiple configurations during development and I wanted to save every engineer on the team from running their own API server locally.
We use Travis CI to test our cookbooks and why not have the server running right where the information is needed. To simplify this example, I replaced hosted chef in the
config.json with the Supermarket configuration but this would work with any of the supported endpoints.
ENV['BERKSHELF_API_PATH']is set to the root of the repository to override the default of
- Travis encrypted environment variables are provided for
- The SSH private key is added via
- Cache for APT and Bundler are both enabled to speed up test runs
- Package containing
- AWS resource tags are applied to the EC2 instances to help identify them
After figuring out the Bundler cache hiccups, I ran into an issue that one of my coworkers had reported earlier this year. As pointed out there, uploading compressed tarballs or switching to
sftp may be the best course of action but for now removing the empty directories results in a massive performance improvement.
The trickiest part of this test was getting the IAM configuration correct, so I'll explain that in another post.