It is real easy to automate the deletion of multiple jobs in jenkins. In Google Chrome open Developer Tools > Network. Now click on the delete job link on one of the jenkins jobs you want to delete.
Now inside the developer tools > network section you will see a post request being made to the jenkins server. Right click on the post request and choose copy as curl.
Your string will look something like
curl "http://servername:port/job/job_name/doDelete" -X POST -H "Cookie: JSESSIONID...
JSESSIONID...
JSESSIONID...
..." -H "Referer: http://servername:port/job/job_name/" -H "Connection: keep-alive" -H "Content-Length: 0"
Replace the job_name with whatever job name you want and run the curls as part of script. Voila! Fast Delete in Jenkins!
Now inside the developer tools > network section you will see a post request being made to the jenkins server. Right click on the post request and choose copy as curl.
Your string will look something like
curl "http://servername:port/job/job_name/doDelete" -X POST -H "Cookie: JSESSIONID...
JSESSIONID...
JSESSIONID...
..." -H "Referer: http://servername:port/job/job_name/" -H "Connection: keep-alive" -H "Content-Length: 0"
Replace the job_name with whatever job name you want and run the curls as part of script. Voila! Fast Delete in Jenkins!
Thanks, This approach saved my 30 minutes.
ReplyDeleteDeleting Jenkins jobs using curl is a straightforward process. This command-line tool allows for easy automation of tasks, including job removal. Is Online Snake It streamlines job management, enhancing efficiency for administrators.
ReplyDelete