Monday 16 December 2013

How to purge a hudson job from backend when UI hangs

Problem : I was trying to delete/purge a job in hudson from front end[UI]. So I clicked on the job and then "Delete Project". The window opened up saying "Checking if this job can be deleted" and this went forever. I researched over the internet and could't find a concrete answer and so I decided to troubleshoot this issue on my own.

Solution :
        1) Login to your master hudson server.
        2) Find your hudson-cli.jar on the machine.
             I ran "find / -iname hudson-cli.jar" to locate it on my machine and found it at  
             /var/lib/hudson/war/webapp/WEB-INF/hudson-cli.jar
        3) Now I played around with this jar to get "help" to understand the commands.
            To get exhaustive list of all those commands, run:
            java -jar hudson-cli.jar -s http://10.0.5.1:8080 help --username <username> --password 
             <password> &>   commands
        4) I went through the list of commands and found the command, delete-job  and utilised it in the
            below manner:
             java -jar hudson-cli.jar -s http://10.0.5.1:8080 delete-job test_project --username <username>
             --password <password>
 
             This fixed the issue at my end.