Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List what plugins are in use in my scripted Jenkins Pipeline

I am trying to determine what plugins, if any, are currently being used in a number of scripted Jenkins Pipelines, is there a programmatic way to determine this information, or am i going to need to go through every pipeline to look for calls to plugins?

I found this article, but it states that this does not cover pipelines. https://cruftex.net/2015/11/30/Jenkins-Analyze-Your-Plugin-Usage.html

This article also points to https://issues.jenkins-ci.org/browse/JENKINS-31582 which is stated as resolved, but I don't see API documentation on how to get this information still.

The version of Jenkins I'm using is 2.46.1

like image 526
James Avatar asked Oct 16 '18 17:10

James


People also ask

How do you know which plugins are used in Jenkins?

Go to Manage Jenkins. In the Tools and Actions section, select Plugin Usage. To see the list of locations where a plugin is used, click the down arrow on the right side of the row for a plugin.

How do I list all plugins in Jenkins?

From the Jenkins home page: Click Manage Jenkins. Click Manage Plugins. Click on the Installed tab.

What are the script used in Jenkins pipeline?

The script has the elements “pipeline”, “agent” and “steps” which are specific to Declarative Pipeline syntax; “stage” is common to both Declarative and Scripted; and finally, node” is specific for the Scripted one. “Pipeline” defines the block that will contain all the script content.

What is the plugin used to show the pipeline of build jobs?

Pipelines are Jenkins jobs enabled by the Pipeline (formerly called “workflow”) plugin and built with simple text scripts that use a Pipeline DSL (domain-specific language) based on the Groovy programming language.


1 Answers

This article also points to https://issues.jenkins-ci.org/browse/JENKINS-31582 which is stated as resolved, but I don't see API documentation on how to get this information still.

This was added to Workflow-API plugin, meaning if you would have a job, with name lets say test, you can get some more result by visiting the following address: http://your_jenins/job/test/12/api/json?pretty=true. Where 12 should be the job number you are interested with. This plugin is poorly documented though.

The part you are interested in was added to actions. For example, in my case:

_class  "org.jenkinsci.plugins.workflow.job.WorkflowRun"
actions 
0   
_class  "hudson.model.CauseAction"
causes  
0   {…}
1   {}
2   {}
3   {}
4   {}
5   
_class  "org.jenkinsci.plugins.pipeline.modeldefinition.actions.RestartDeclarativePipelineAction"
6   {}
7   
_class  "org.jenkinsci.plugins.workflow.job.views.FlowGraphAction"
8   {}
9   {}
10  {}
artifacts   []
like image 145
hakamairi Avatar answered Oct 21 '22 00:10

hakamairi