Delete jenkins project after build

3.1k views Asked by At

A user is able to create jenkins jobs from the application in order to schedule an action.

I would like to know if it's possible to delete a jenkins project after the build has been executed. There is the Post-build action "delete workspace when build is done" but it only deletes the workspace, not the project.

2

There are 2 answers

0
gile On BEST ANSWER

It should be possible with an HTTP POST

http:///jenkinsServer/job/yourJob/doDelete

Look at http://jenkinsServer/job/YourJob/api/?

Delete a job

To programmatically delete this job, do HTTP POST to this URL.

0
StephenKing On

Using the Groovy Postbuild Plugin, you can execute code after the build. Now it is only up to you to figure out, how to delete a Jenkins job using Groovy. This question might be a starting point.