Search code examples
jenkinshudson

hudson CI: how to delete all jobs?


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


Solution

  • 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();
    }