Sayak Banerjee
Sayak Banerjee

Reputation: 1964

Jenkins - cleanup after job

I have a couple of unit testing / BDD jobs on our Jenkins instance that trigger a bunch of processes as they run. I have multiple Windows slaves, any one of which can run my tests.

After the text execution is complete, irrespective of the build status is passed/failed/unstable, I want to run "taskkill" and kill a couple of processes.

I had been doing that earlier by triggering a "Test_Janitor" downstream job - but this approach doesn't work anymore since I added more than one slave.

How can I either run the downstream job on the same slave as the upstream, or have some sort of a post build step to run "taskkill".

Upvotes: 0

Views: 1079

Answers (1)

Bruno Lavit
Bruno Lavit

Reputation: 10382

You can install the Post Build Task plugin to call a batch script on the slave (when your UT/BDD are completed).

The other solution is to call a downstream job and to pass the %NODE_NAME% variable to this job with the Parameterized Trigger plugin.

Next, you can use psexec to kill the processes on the relevant node.

Upvotes: 1

Related Questions