37

Is there any method or plugins available to retrieve deleted Jenkins job?

I have mistakenly deleted one job from Jenkins. So please give a suggestion to undo the delete.

mahinlma
  • 1,208
  • 3
  • 11
  • 24

4 Answers4

51

In fact you have just to use this url to reactivate your deleted job : http://[url_of_jenkins]/jobConfigHistory/?filter=deleted

You just need to have this plugin installed beforehand: https://wiki.jenkins.io/display/JENKINS/JobConfigHistory+Plugin

Gert Arnold
  • 105,341
  • 31
  • 202
  • 291
ahmed.ettoumi
  • 704
  • 7
  • 16
12

It is not possible unless you somehow restore files from your master operating system. In future you can use plugin: https://wiki.jenkins-ci.org/display/JENKINS/JobConfigHistory+Plugin. This plugin saves configuration files for deleted jobs (but not build history).

jussuper
  • 3,397
  • 1
  • 12
  • 12
7

Job configs are stored on disk under $JENKINS_HOME/jobs, so if you have a backup of that directory, then you can restore the job.

Otherwise, there's no "recycle bin" for deleted jobs in Jenkins.

In future, if you want to remove a rarely-used job from Jenkins, but there's a small chance that you might want to use it in the future, you can archive the job using the Shelve Project plugin.

Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
  • You can also manually archive any job folder under ${JENKINS_HOME}/ and store it some place else with possibility to unpack and replace to restore previous state of the job / build logs etc. – Zloj Aug 05 '15 at 11:32
  • But if the project gets deleted the logs are also gone from the machine in the folder $JENKINS_HOME/jobs. Let me know how that can be fixed. – Keshav Maheshwari Dec 22 '22 at 11:20
1

Download Plugin Job Config History

Download steps:- Manage Jenkins -> Manage Plugin -> Available -> JobConfigHistory Download and install

After Installation step:- Jenkins -> Job Config History -> Show deleted jobs only and restore the jobs

Peace...