Purge Jenkins - Plugins / Jobs


I want to update my Jenkins 2.306, but first i need to purge obsoletes jobs and unused plugins. I have several questions to do it:

  1. How can i collect a list of jobs that not executed before since last year?
  2. About usage of plugins, i use this plugin Plugin Usage but it’s not very accurate, i’m not sure how to verify the section “others plugins” the doc says "All other plugins that do not implement any of these extension points will be show on the second table “Other plugins”.

For example Is there any groovy script to collect this data?

Regards !

With this script you can print the timestamp when a job was last built. Just run it via script console.

jobs = Jenkins.get().getAllItems(Job.class)

for (job in jobs) {
    r = job.getLastBuild()
  if (r != null) {
    println(job.getFullName() + ": " + r.getTimestampString2())
  } else {
    println(job.getFullName() + " never built")

Regarding the plugins, there are plugins that do not provide functionality for jobs or are not directly used by jobs, e.g. the security realm, authorization, node management, clouds and other things. Also with pipelines as you can’t analyze the Jenkinsfile easily with system groovy, it is hard to say if a plugin is used there.

1 Like