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
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise - Operations center
Resolution
First, you will need to find the plugin id on the controller. 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()}") } return
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() return "Plugin uninstalled"
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 controller is next restarted.