Hello everyone.
I've asked this already on the Freenode-IRC, but on second thought this is
a better place.
During a Maven test execution my JVM needs to spawn a external process
using Javas ProcessBuilder-API. At the end of the test, the process is
killed. This works in JUnit standalone, Maven surefire, but not within a
Jenkins-Pipelines Maven-step.
I see that the process is started (process console output), but it gets
killed within 1 or 2 seconds by something else than my test. The test
stores the pid of the started process and uses this pid to get a handle to
kill it at the end, but when the test is cleaning up, no process matches
the pid (hence I know that something else must have killed it).
As far as I know, the ProcessTreeKiller in Jenkins is responsible for
killing processes spawned during job-execution. I thought that the
ProcessTreeKiller is only running at the end of each Job. Nevertheless I
tried setting JENKINS_NODE_COOKIE=dontkill as well as BUILD_ID=dontkill
without avail.
All this happens within a single step:
withMaven(maven: 'maven361', jdk: 'openjdk11') {
sh "mvn -p integration-test verify"
}
Is there anything in Jenkins which prevents spawning processes from a JVM
(Maven)?
For the interested some background: I need to connect to a Kubernetes Pod
via TCP which is not possible via Ingress. Hence I need to call "kubectl
port-forward" and extract the dynamic allocated port from the process.
Thats why my test is in charge of the external process (otherwise I could
open it from the pipeline).
best regards
Marc
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/c896713c-86b2-45e5-b7cd-2c16302f6c37%40googlegroups.com.