How to uninstall a plugin via a Cluster Operation

Issue

Is there a way to uninstall a plugin via a Cluster Operation?

I see:
* Disable plugin
* Enable plugin
* Install plugin

But no “Uninstall plugin” step.

Environment

Resolution

First, you will need to find the plugin id on the master. You can use the following script in the Script Console to do that:

Jenkins.instance.pluginManager.plugins.each{
  plugin -> 
    println (" Display Name: ${plugin.getDisplayName()}, Plugin Id: ${plugin.getShortName()}")
}

To uninstall the plugin, you can use the following script in a Cluster Operation:

String pluginId = "mock-security-realm"
def plugin = Jenkins.getInstance().getPluginManager().getPlugin(pluginId)
plugin.doDoUninstall()

In the above example, the plugin mock-security-realm is to be uninstalled.

This will result in an Uninstallation pending status for the plugin. The plugin will be removed completely after the master is next restarted.

Have more questions?

0 Comments

Please sign in to leave a comment.