Reputation: 21
I got a task to create a (chef) cookbook that should install jenkins plugins.
Note: when i apply the cookbook it should install it automatically.
Thanks in advance.
Upvotes: 0
Views: 874
Reputation: 37630
There is a jenkins cookbook that does this very well (look at the "jenkins_plugin" section)
Upvotes: 2
Reputation: 987
The Chef public Supermarket cookbook can be found here. If I was you, I would use that as the base for the functionality you require.
Note: In order to find the correct .HPI file location for the version of the plugin you want to download, you can look at the Jenkins Wiki page for each plugin, and using the link to the archives of all releases of that plugin find a suitable link for the version you wish to install.
An additional step that I personally take is to write some automated tests to run against the plugin installation / configuration using Chef's test-kitchen:
And last but not least; I strongly recommend you use Berkshelf to manage your cookbook dependencies. If you go this route, it will be critical that you create your own cookbook which depends on the public cookbook so as you are able to upgrade your public cookbooks using Berkshelf without issue.
If not, all your custom configuration for plugins you have added to your copy of the public supermarket cookbook will be overwritten when you upgrade your public cookbook to the newest version when it's released.
Best of luck and please post any additional questions here!
Upvotes: 1