Managing a Jenkins instance effectively requires a deep understanding of its installed plugins. Knowing exactly which plugins are installed, along with their specific versions, is crucial for troubleshooting issues, ensuring compatibility, and maintaining overall system stability. Determining how to get a list of installed Jenkins plugins with name and version pair is a common task for Jenkins administrators and developers. This blog post will provide a comprehensive guide on how to achieve this, offering various methods and techniques to suit different environments and skill levels. We’ll explore using the Jenkins web interface, the Jenkins CLI, and even scripting approaches to retrieve this vital information. Armed with this knowledge, you can confidently manage your Jenkins plugins and keep your CI/CD pipeline running smoothly. This process ensures that you have a clear picture of the plugins installed on your Jenkins server, making it easier to audit, update, and maintain your system.
Understanding the Importance of Plugin Management in Jenkins
Jenkins’ extensibility through plugins is one of its greatest strengths. However, this flexibility also introduces complexity. Inefficient plugin management can lead to various problems, including dependency conflicts, performance degradation, and even security vulnerabilities. Regularly reviewing and updating your Jenkins plugins is a critical aspect of maintaining a healthy and secure CI/CD environment. Keeping an accurate record of installed plugins, including their names and versions, is the first step toward effective plugin management. This record allows you to quickly identify outdated plugins, assess potential security risks, and ensure compatibility with your Jenkins version and other installed tools.
The ability to quickly get a list of installed Jenkins plugins with name and version pair is also essential for auditing purposes. Many organizations have strict compliance requirements, and demonstrating proper plugin management is often a key component of these audits. By maintaining a detailed inventory of your plugins, you can readily provide auditors with the information they need. Furthermore, knowing the specific versions of your plugins can be invaluable when troubleshooting issues. If you encounter a bug or unexpected behavior, knowing the plugin versions can help you quickly determine if the issue is related to a specific plugin version or incompatibility.
According to a recent study by CloudBees, approximately 60% of Jenkins instances have at least one outdated plugin, potentially exposing them to security vulnerabilities. Regularly updating plugins is vital for patching these vulnerabilities and ensuring the continued security of your Jenkins environment. By understanding how to get a list of installed Jenkins plugins with name and version pair, you can better track and manage your plugin updates, reducing your risk of exposure to security threats. This proactive approach to plugin management is a key element of a robust DevOps strategy.
Methods to Retrieve the Plugin List
There are several methods to retrieve a comprehensive list of your installed Jenkins plugins along with their names and version numbers. Each method caters to different user preferences and technical expertise levels. We will cover the most common and effective approaches. The method you choose depends on your access level, comfort with command-line tools, and specific requirements for automation.
Using the Jenkins Web Interface
The simplest way to get a list of installed Jenkins plugins with name and version pair is through the Jenkins web interface. This method is accessible to anyone with administrative privileges. Navigate to the “Manage Jenkins” section, then click on “Manage Plugins.” Under the “Installed” tab, you will see a list of all installed plugins. While the default view may not show the version numbers directly, you can click on each plugin to view its details, including the version. This is a straightforward, albeit manual, process. However, it is ideal for a quick overview and for users who prefer a graphical interface. This method is particularly useful for smaller Jenkins installations where the number of plugins is manageable.
To enhance this method, consider using the browser’s search function (Ctrl+F or Cmd+F) to quickly find specific plugins within the list. This can be helpful if you are looking for a particular plugin or want to verify if a specific version is installed. Remember that this method requires you to manually click on each plugin to view its version, which can be time-consuming for larger installations. Despite this limitation, the web interface provides a user-friendly way to get a list of installed Jenkins plugins with name and version pair. It is an excellent starting point for understanding your Jenkins plugin landscape.
Leveraging the Jenkins CLI (Command-Line Interface)
The Jenkins CLI provides a more efficient and scriptable way to get a list of installed Jenkins plugins with name and version pair. This method is ideal for automating plugin management tasks. To use the CLI, you first need to configure it to connect to your Jenkins instance. Once configured, you can use the list-plugins command to retrieve a list of all installed plugins. The output will include the plugin name, version, and other metadata. This method requires some familiarity with command-line tools but offers significant advantages in terms of automation and efficiency.
Here are the steps to get your plugin list using the Jenkins CLI:
- Download the jenkins-cli.jar file from your Jenkins instance (usually found at http://your-jenkins-url/jnlpJars/jenkins-cli.jar).
- Open your terminal or command prompt.
- Run the following command: java -jar jenkins-cli.jar -s http://your-jenkins-url -auth username:password list-plugins. Replace http://your-jenkins-url with your Jenkins URL and username:password with your Jenkins credentials (or API token).
- The output will display a list of installed plugins with their names, versions, and other details.
The Jenkins CLI offers a powerful way to automate tasks. For example, you could script the list-plugins command to regularly check for outdated plugins and send notifications to administrators. This proactive approach can help you stay ahead of security vulnerabilities and ensure that your Jenkins environment is always up-to-date. Using the Jenkins CLI to get a list of installed Jenkins plugins with name and version pair is a valuable skill for any Jenkins administrator.
Scripting with Groovy
For maximum flexibility, you can use Groovy scripting within Jenkins to get a list of installed Jenkins plugins with name and version pair. Groovy is the scripting language used by Jenkins, allowing you to interact directly with the Jenkins API. This method is particularly useful for complex scenarios where you need to filter or process the plugin list in a specific way. You can execute Groovy scripts directly within the Jenkins Script Console or as part of a Jenkins job.
Here’s an example Groovy script to retrieve the plugin list:
import jenkins.model.Jenkins Jenkins.instance.pluginManager.plugins.each { plugin -> println "${plugin.shortName}:${plugin.version}" }
This script iterates through all installed plugins and prints their short name and version to the console. You can modify this script to suit your specific needs, such as filtering plugins based on their name or version, or exporting the data to a file. Groovy scripting provides the ultimate level of control and customization when you get a list of installed Jenkins plugins with name and version pair. This is a crucial skill for those managing large, complex Jenkins environments.
Ensuring Security and Best Practices
When managing Jenkins plugins, security should be your top priority. Always download plugins from trusted sources, such as the official Jenkins plugin repository [ Jenkins Plugins ]. Regularly update your plugins to patch security vulnerabilities. Implement access control to restrict plugin installation and management to authorized personnel only. Regularly audit your installed plugins to identify and remove any unnecessary or potentially malicious plugins.
Here are some additional best practices to follow:
- Keep Jenkins up to date: Regularly update your Jenkins instance to the latest version to benefit from security patches and performance improvements.
- Use a plugin management tool: Consider using a plugin management tool to simplify the process of installing, updating, and managing your plugins.
For example, the “Plugin Usage” plugin can help you identify which jobs are using specific plugins. This information can be invaluable when planning plugin updates or removals. Furthermore, consider using a configuration management tool, such as Ansible or Chef, to automate the plugin installation and update process across multiple Jenkins instances. By following these best practices, you can ensure that your Jenkins environment remains secure and stable. Always prioritize security when you get a list of installed Jenkins plugins with name and version pair and manage your Jenkins plugins.
Featured Snippet Paragraph: To quickly get a list of installed Jenkins plugins with name and version pair, use the Jenkins CLI command java -jar jenkins-cli.jar -s http://your-jenkins-url -auth username:password list-plugins. This command retrieves a detailed list of all installed plugins, including their names, versions, and other relevant metadata, making it easy to audit and manage your Jenkins plugin ecosystem. Remember to replace http://your-jenkins-url with your actual Jenkins URL and username:password with valid credentials.
- How do I find the Jenkins CLI?
- You can download the jenkins-cli.jar file from your Jenkins instance, typically found at http://your-jenkins-url/jnlpJars/jenkins-cli.jar.
- What if I don't have admin access to Jenkins?
- If you lack admin privileges, you'll need to request the plugin list from someone with administrative access or explore alternative methods that don't require full admin rights, such as querying the Jenkins API (if enabled) through a tool like curl \[ [cURL Official Website](https://curl.se/) \].
- Can I automate plugin updates?
- Yes, you can automate plugin updates using the Jenkins CLI or Groovy scripting. You can create a scheduled job that automatically checks for updates and installs them. Be sure to test updates in a non-production environment first. See the official Jenkins documentation for details \[ [Jenkins Documentation](https://www.jenkins.io/doc/) \].
- Regularly audit your plugins for security vulnerabilities.
- Automate the process of listing and updating plugins where possible.
Now that you’re equipped with the knowledge to get a list of installed Jenkins plugins with name and version pair, take action! Review your current plugin configuration, identify any outdated or unnecessary plugins, and implement a plan for ongoing plugin management. Consider exploring related topics such as Jenkins security best practices and automation strategies for CI/CD pipelines. Don’t forget to check out our other helpful Jenkins guides to further enhance your DevOps skills and knowledge.
Question & Answer :
How can I get a list of installed Jenkins plugins?
I searched the Jenkins Remote Access API document, but it was not found. Should I use Jenkins’ CLI? Is there a document or example?
You can retrieve the information using the Jenkins Script Console which is accessible by visiting http://<jenkins-url>/script. (Given that you are logged in and have the required permissions).

Enter the following Groovy script to iterate over the installed plugins and print out the relevant information:
Jenkins.instance.pluginManager.plugins.each{ plugin -> println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}") }
It will print the results list like this (clipped):
This solutions is similar to one of the answers above in that it uses Groovy, but here we are using the script console instead. The script console is extremely helpful when using Jenkins.
Update
If you prefer a sorted list, you can call this sort method:
def pluginList = new ArrayList(Jenkins.instance.pluginManager.plugins) pluginList.sort { it.getShortName() }.each{ plugin -> println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}") }
Adjust the Closure to your liking (e.g. here it is sorted by the shortName, in the example it is sorted by DisplayName)
