Join GitHub today
[JENKINS-27177] Add disable plugin command and tests #3648
Added a new CLI command
Proposed changelog entries
If you call it with:
It responds with:
Return code: 16 (because one plugin couldn't be disabled)
I think so too. But I wanted to have a first implementation to discuss a more complex one, messages and behavior.
There are more topics to discuss, as:
The process is moved to the core itself, allowing it to be used along the code, not only by the CLI command.
The former disable method (without any check) is deprecated in favor of the new one. The new method returns a PluginDisableResult with the result of the operation over each plugin (the one who we wanted to disable and its depedants plugins, depending on the strategy used). It gives you:
Added the optionalDependants list to the PluginWrapper to be able to process it efficiently.
Improved the PluginManager.resolveDependantPlugins method to avoid unnecessary iterations and added the disablePlugins method.
In the command itself, I've renamed the option cascade to strategy, added quiet option, moved the procedure itself to the PluginManager and PluginWrapper classes to be able to reuse it and I keeped printing the output and calculating the result code in the command class.
Also improved messages and test class: add more tests and avoid having to know the output messages in the test class.
For the release notes / changelog, we should mention: