Complete the code to check the installed plugin version in Jenkins.
def plugin_version = Jenkins.instance.pluginManager.getPlugin('[1]').version
The code uses Jenkins API to get the version of the 'git' plugin installed.
Complete the code to list all installed plugins in Jenkins.
def plugins = Jenkins.instance.pluginManager.[1]()
The method getPlugins() returns all installed plugins in Jenkins.
Fix the error in the code to check if a plugin is active.
def isActive = Jenkins.instance.pluginManager.[1]('git').isActive()
The correct method to get a single plugin is getPlugin. Then isActive() checks if it is active.
Fill both blanks to create a map of plugin names and their versions.
def pluginMap = Jenkins.instance.pluginManager.[1]().collectEntries { [it.[2], it.version] }
getPlugins() returns all plugins. Using collectEntries with it.name creates a map key for each plugin name.
Fill all three blanks to filter plugins by version greater than 2.0 and create a map of their names and versions.
def filtered = Jenkins.instance.pluginManager.[1]().findAll { it.[2] > '[3]' }.collectEntries { [it.name, it.version] }
getPlugins() gets all plugins. version is used to compare plugin versions. The string '2.0' is the version threshold.