Steps
- Log into Jenkins server
- Navigate to Manage Jenkins
- Select Script Console
- Copy and adapt snippet from fig.1
- Select Run
- Check job and build numbers/history should be deleted/gone
fig.1
def jobName = "Enter Job Name"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.save()
Hi @caffeinetiger please suggest what should be the mechanism for clearing build numbers in case of multibranch pipeline and also jobs under a folder e.g. myfolder/job_name?
TIA