问题
Is there any way I can integrate Jenkins with Chef Server so that I can create jobs to be executed? I don't want to have to go to the Chef Workstation.
Do I need to install jenkins on a separate server or the chef workstation?
Can I execute all the recipes directly from the Jenkins console?
回答1:
Yes. You can create jobs in jenkins and can be integrated with chef. Knife search would be the best option. you can run chef-client to run recipes through jenkins to any machine.
回答2:
Look into this chef-plugin. It might help. I have not tried it.
I hope this helps.
回答3:
We managed to have this working except automatic deployment (I am doing some research if there is such thing yet).
What I recommend is having Jenkins slave connecting to your master (i.e. using Swarm plugin). This slave could be machine (i.e. Ubuntu server edition) with QEMU/KVM virtualization, Ruby, Vagrant (or other tool), ChefClien, TestKitchen, RSpecs (chefspecs) and Foodcritic. There is Chef Development Kit that has many of this.
What build do:
- Checkout your chef repository
- Run `kitchen test all' (or only subset of your suites)
- If status is 0 then execute
rspec --format doc
(from yours cookbook directory - If status is 0 then execute
foodcritic -f
- If status is 0 then you can upload your cookbook
knife upload cookbooks/my_cookbook
What we haven't figure out yet is:
- Update (increase) version of cookbook (if doing release)
- Still quite error prone approach using status and shell scripts in jenkins build
More resources:
- Foodcritic CI
回答4:
try these Jenkins plugins:
https://github.com/zhelyan/jenkins-chef-api
together with
https://github.com/zhelyan/jenkins-chef-wrapper
来源:https://stackoverflow.com/questions/24861027/jenkins-ci-with-chef-server