0

I have a situation where I have 2 jobs. My main 1st jenkins project trigger an another 2nd project using "Trigger/call builds on other projects" plug-in. My 2nd project is kind of server which I am starting first using trigger and my main 1st project process all over it. Now I want to stop my 2nd zombie project once my 1st project build is done.

I have found some reference like below:-

How to stop an unstoppable zombie job on Jenkins without restarting the server?

But I want to stop my zombie job automatically once my main project build complete

I have found one way

How to stop a build in Jenkins via the REST api ?

I have tried by hitting Rest API of Jenkins

http://localhost:8086/job/JOB_Name/14/stop

But getting error like below

>     HTTP ERROR 403
>     
>     Problem accessing /job/TestZAP/14/stop. Reason:
>     
>         No valid crumb was included in the request

enter image description here

I have also hit curl command as below :-

C:\Users\Shubham Jain>curl -X POST http://admin:252ec0f4ac@localhost:8086/job/TestZAP/build -H "CRUMB"

But getting error as below:

Error 403 No valid crumb was included in the request

HTTP ERROR 403

Problem accessing /job/TestZAP/build. Reason:

    No
valid crumb was included in the request

Powered by Jetty:// 9.4.z-SNAPSHOT

Is there is any way to do this?

//////////////////////////////////////////////////

At the end I have disabled CSRF Protection -> Prevent Cross Site Request Forgery exploits After hitting URL like :- http://localhost:8086/job/TestZAP/15/stop

Still getting response are appears as :-

POST required POST is required for hudson.model.AbstractBuild.doStop

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
  • This related question has a good answer https://stackoverflow.com/questions/14456592/how-to-stop-an-unstoppable-zombie-job-on-jenkins-without-restarting-the-server – Rachel Jan 19 '18 at 11:03

1 Answers1

0

I just disable the disabled CSRF Protection -> Prevent Cross Site Request Forgery exploits from Jenkins

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125