How to install jenkins plugin using chef? - jenkins

Currently jenkins does not have a proxy setup and I need to install a Jenkins plugin.
I am looking for some pointers in doing so using Chef.

Have a look at the jenkins cookbook from Chef supermarket.
Once you add the appropriate dependency in your cookbook. Then you can use this cookbook's jenkins_plugin resource to manage plugins. Example to install a plugin named myplugin:
jenkins_plugin 'myplugin' do
version '1.0'
end

Related

Jenkins Gradle Plugin is not installing

Some of the Jenkins plugins are not installing on my ubuntu after choosing to install suggested plugins the first time of launch Jenkins.
you can always download plugins in jenkins manually. In the UI go to Manage Jenkins > Manage Plugins> search needed plugin and install . make sure you are also downloading all the dependencies to make the plugin working fine.

There is no AWS Codedeploy Plugin in Jenkins

I use two different Jenkins servers(tomcat jenkins) and i was trying to install a plugin for aws codedeploy.
However, I couldn't find it in the list of a Jenkins but another one has it.
Why the plugin libraries are different? even though i install them in a same way.
Also, How can i add a particular plugin in my Jenkins server?
Thank you.
Why the plugin libraries are different?
The plugin libraries shouldn't be different.
Which way did you search the plugin (jenkins gui, in the web)? Both your servers are on the same Jenkins version?
Also, How can i add a particular plugin in my Jenkins server?
I do it always via the GUI as described here: https://jenkins.io/doc/book/managing/plugins/

Jenkins find installed plugins

I am new to Jenkins. I have installed some plugins like maven, JDK parameter on my local jenkins server. After installing the same it doesn't appear in the "Configure system" page. I tried to restart my machine, to see if its required but it didn't help. Could someone guide on what are the steps to be followed to use the installed plug in in the configure system page.
Take a look at the official Jenkins wiki: https://wiki.jenkins-ci.org/display/JENKINS/Plugins
Make sure your Jenkins version supports the version of the plugins you want to install.

Jenkins Plugin installation with chef cookbook

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.
There is a jenkins cookbook that does this very well (look at the "jenkins_plugin" section)
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.
Create a new cookbook which depends on the public Jenkins cookbook
(this will cause your new cookbook to inherit all functionality
found in the public cookbook).
Create a new recipe in your new cookbook which specifies which
plugins to be installed when Jenkins is installed / configured. See the Jenkins_Job section of the Chef Supermarket Jenkins cookbook for additional details.
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:
What I do is find the filepath for the particular plugin you want to
verify has been installed, and write a test confirming that the
filepath exists.
An additional test I also write for each plugin is to parse the
pom.xml configuration file found within the directory in order to
verify that the correct version has been installed (in the event the
link to the specific release available on the Jenkins Wiki is giving
you the incorrect version).
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!

Using Jenkins CLI to configure plugins

I am working on installing and configuring Jenkins automatically using the Jenkins CLI. I am able to install plugins such as the Active Directory plugin, but haven't figured out how to configure it. Is it possible to perform such tasks from the CLI? From a Jenkins GUI standpoint, I'd like to check the Enable security checkbox under Security Realm check the Active Directory option, provide parameters to Active Directory, and under Authorization check the Anyone can do anything option.
I'm using a Puppet module (https://forge.puppetlabs.com/rtyler/jenkins) for the automation.
Greetings,
Kenneth
If you want to modify their configuration files manually using scripts called from the CLI, then yes.
Else, I don't believe there is. At least, not a general way for all plugins. Plugins are capable of adding CLI commands, as per this documentation page:
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
Extending CLI
Plugins installed on Jenkins server can add custom CLI commands. See Writing CLI commands for more details.
So, some of the plugins you're using may have specific commands to configure them from the CLI.
So as far as I know those are your options. Manual configuration through editing their config files, or hoping your plugin includes some commands in the CLI that is specific to it.
There is currently a new Plugin in development called "Configuration as Code Plugin" to provide a way for configuration of plugins using YAML: https://github.com/jenkinsci/configuration-as-code-plugin/
They are currently in an early development stage but this could help solve this kind of problem.

Resources