Jenkins
  • Introduction
  • 1. Jenkins Basics
    • 1.1 Run Jenkins as-is
    • 1.2 Installation of Jenkins
    • 1.3 Installation of jenkins on Tomcat
  • 2. Jenkins Configurations
    • 2.1 Configure Jenkins Slave
    • 2.2 Configure SonarQube with Jenkins
    • 2.3 Configure SilkCentral with Jenkins
    • 2.4 Configure TestNG with Jenkins
  • 3. How to use Jenkins
    • 3.1 Create jobs
    • 3.2 Run jobs
    • 3.3 Run Single Job Parallely in Multiple slaves
  • 4. Jenkins Integrations
    • 4.1 Analysis with SonarQube using Jenkins
    • 4.2 SCTM Result Analysis with Jenkins
    • 4.3 TestNG Result Analysis with Jenkins
  • 5. Jenkins Advanced
    • 5.1Jenkins Challenges
Powered by GitBook
On this page

Was this helpful?

  1. 5. Jenkins Advanced

5.1Jenkins Challenges

Previous5. Jenkins Advanced

Last updated 5 years ago

Was this helpful?

hudson CI: how to delete all jobs?

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

A: The easiest way, IMHO, would be to use script. Go to

Delete jobs by running in Older versions(1.x):

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\(\)

}

Q: How to reset build number in jenkins?

A: Can be easier done from groovy script console . Go to In script window enter:

item = Jenkins.instance.getItemByFullName("your-job-name-here")

//THIS WILL REMOVE ALL BUILD HISTORY

item.builds.each() { build ->

build.delete()

}

item.updateNextBuildNumber(1)

OR

echo "deleting all builds of ${jobName}" item = Jenkins.instance.getItemByFullName("${jobName}") for (build in item.builds){ build.delete(); } item.updateNextBuildNumber(1)

For ALL PROJECTS

Jenkins.instance.allItems.each() {

item -> item.builds.each() {

build -> build.delete\(\)

}

item.updateNextBuildNumber(1)

}

http://your.hudson.url/script/
http://your-jenkins-server/script