Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hudson CI: how to delete all jobs?

Tags:

I have about 100 jobs on my hudson CI, possible to mass delete them ?

like image 287
KJW Avatar asked Feb 22 '11 09:02

KJW


People also ask

How do I delete multiple Jenkins projects?

Go to project which you want to delete, in upper left frame, you can see delete (maven, if it is maven project) project. Show activity on this post. If this is a maven project then in the left side panel, you can see the option as delete maven project.

How do I delete old jobs in Jenkins?

Open Jenkins project and click on configure to open configuration screen for the project. Locate the discard old builds checkbox. Select discard old builds checkbox to see more options. Type number of days to 10 or any other desired value.


2 Answers

The easiest way, IMHO, would be to use script. Go to http://your.hudson.url/script/

Delete jobs by running:

for(j in hudson.model.Hudson.theInstance.getProjects()) {     j.delete(); } 

And this way gives you an option to easily use condition to filter out jobs to delete.


FOR JENKINS

Current versions (2.x):

for(j in jenkins.model.Jenkins.theInstance.getAllItems()) {     j.delete() } 

Older versions:

for(j in jenkins.model.Jenkins.getInstance().getProjects()) {     j.delete(); } 
like image 189
Sergey Grinev Avatar answered Oct 20 '22 19:10

Sergey Grinev


Just delete the job directories:

cd $HUDSON_HOME/jobs rm -rf <JOB_NAME> 

See: Administering Hudson

like image 21
dogbane Avatar answered Oct 20 '22 17:10

dogbane