0

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.

xAngy
  • 27
  • 1
  • 9
  • I don't know if it's possible but my guess would be that it's not. Why would anyone want to do this? It really sounds like you are using Jenkins for something it wasn't intended for and you should reconsider your choice of tools. – André Stannek Jan 04 '17 at 09:08

2 Answers2

0

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.

gile
  • 5,580
  • 1
  • 25
  • 31
0

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.

Community
  • 1
  • 1
StephenKing
  • 36,187
  • 11
  • 83
  • 112