To set up Jenkins for a new cookbook:
In Bitbucket:
- Open the repository
- Click the "Settings" gear on the left-hand menu
- Click "Hooks" on the left-hand menu
- Click "Enabled" on "Post-Receive WebHooks"
- Enter "http://oce-249.oc.mckesson.com:8080/bitbucket-hook/" as the URL
- Click "Enable"
In Jenkins:
- Click the "Chef Cookbooks" folder
- Click "New Item" on the left-hand menu
- Enter the item name. It is recommended that this match the repository name
- Select "Freestyle project"
- Under "if you want to create a new item from other existing, you can use this option", enter "_cookbook_template"
- Click "OK"
- Replace or clear the Description
- Click the "Advanced..." button under "Name of template"
- Check the box next to "Retain local Source Code Management"
- Under "Source Code Management", update the "Repository URL" field to the correct URL
- Click "Save"
- If you'd like to test the build, click "Build Now". You can then click the build, and "Console Output" if troubleshooting is necessary.
To update the commands used for the build process: In Jenkins:
- Click the "Chef Cookbooks" folder
- Click "_cookbook_template"
- Click "Configure" in the left-hand menu
- Update the text area under "Build"
- Any changes will be applied to all existing and future projects
To add additional Chef Server to upload to: SSH to Jenkins:
- cd to /var/lib/jenkins
- Make a 2nd .chef folder (like .chef-east)
- Add a knife.rb and client key to this new directory
- Create a berkshelf config file with the new chef server and path to client key. See http://berkshelf.com/#configuring-berkshelf for more information.
In Jenkins UI:
- Use the above instructions to update the build process
- Add "berks -c /path/to/berkshelf-config.json upload" to the end of the build