Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell jenkins not to kill processes after successful execution of job in multijob project?

Tags:

jenkins

I have a jenkins multijob project.

In 1st phase, I start databases and build core part.

sample shell command to start Mongodb:

/root/software/mongodb-linux-x86_64-2.6.3/bin/mongod&

In 2nd phase, I have various jobs to build some clients.

After 1st phase job, after starting servers and building core part. I see logs-

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
2016-08-26T20:23:00.815+0530 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2016-08-26T20:23:00.833+0530 [signalProcessingThread] now exiting
2016-08-26T20:23:00.879+0530 [signalProcessingThread] dbexit: 
2016-08-26T20:23:00.903+0530 [signalProcessingThread] shutdown: going to close listening sockets...
2016-08-26T20:23:00.903+0530 [signalProcessingThread] closing listening socket: 7
2016-08-26T20:23:00.903+0530 [signalProcessingThread] closing listening socket: 8
2016-08-26T20:23:00.903+0530 [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
Finished: SUCCESS

This is stopping all the databases and build is failing for phase2 jobs.

How to tell jenkins not to kill processes after a job?

like image 887
Dev Avatar asked Aug 26 '16 15:08

Dev


People also ask

How do you run the job in Jenkins after successful execution of the another job?

You can follow the below steps to trigger a Jenkins pipeline in another Jenkins pipeline. Select a job that triggers a remote one and then go to Job Configuration > Build section > Add Build Step > Trigger builds on remote/local projects option.

How do I stop the execution in Jenkins?

BUILD ID URL/stop - aborts a Pipeline. BUILD ID URL/term - forcibly terminates a build (should only be used if stop does not work). BUILD ID URL/kill - hard kill a pipeline.


1 Answers

Jenkins uses a special mechanism to cleanup child processes. It looks for process with BUILD_ID matching the build number. You can set that to different value and jenkins will skip killing the process.

From the docs:

https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller

BUILD_ID=dontKillMe /your/mongodb/process

or for pipelines:

JENKINS_NODE_COOKIE=dontKillMe /your/mongodb/process
like image 93
Jayan Avatar answered Oct 18 '22 19:10

Jayan