diff options
author | Kelley Spoon <kelley.spoon@linaro.org> | 2022-04-06 16:55:50 -0500 |
---|---|---|
committer | Kelley Spoon <kelley.spoon@linaro.org> | 2022-04-06 16:55:50 -0500 |
commit | 008357e6ec6012666f45115c587893dcd1399f20 (patch) | |
tree | f59d23b8b280befb0b8e3c3930c94698da085bb0 | |
parent | 689864df939af879dd95d2faffb01446f5513a37 (diff) |
groovy-scripts: add in some more convenience scripts
Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org>
-rw-r--r-- | all_jobs.groovy | 8 | ||||
-rw-r--r-- | decrypt.groovy | 2 | ||||
-rw-r--r-- | get_plugins.groovy | 6 | ||||
-rw-r--r-- | remove_job_by_name.groovy | 14 |
4 files changed, 30 insertions, 0 deletions
diff --git a/all_jobs.groovy b/all_jobs.groovy new file mode 100644 index 0000000..85d743d --- /dev/null +++ b/all_jobs.groovy @@ -0,0 +1,8 @@ +// Get a list of all currently running jobs +def buildingJobs = Jenkins.instance.getAllItems(Job.class).findAll { + it.isBuilding() +} + +for (job in buildingJobs) { + println "${job.name} -> ${job.dump()}" +} diff --git a/decrypt.groovy b/decrypt.groovy new file mode 100644 index 0000000..58a2dda --- /dev/null +++ b/decrypt.groovy @@ -0,0 +1,2 @@ +// dump the secrets for the server +com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{println it.dump().replace(' ', '\n')} diff --git a/get_plugins.groovy b/get_plugins.groovy new file mode 100644 index 0000000..5ef53bb --- /dev/null +++ b/get_plugins.groovy @@ -0,0 +1,6 @@ +// list the plugins installed on the server and its version +def plugin_list = Jenkins.instance.pluginManager.plugins +plugin_list.findAll { + plugin -> + println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}") +} diff --git a/remove_job_by_name.groovy b/remove_job_by_name.groovy new file mode 100644 index 0000000..79618af --- /dev/null +++ b/remove_job_by_name.groovy @@ -0,0 +1,14 @@ +// Get a list of all jobs with a name matching java regex +// Used to clean up jobs created via template if the +// ci/config is deleted without display-name set to 'DELETE ME' +// +// Uncomment the delete line below to actually delete the jobs. + +def buildingJobs = Jenkins.instance.getAllItems(Job.class).findAll { + it.name ==~ /lt-qcom-clo-sync-repo.*/ +} + +for (job in buildingJobs) { + println "${job.name}"; + //job.delete(); +} |