Or you may be able to write a simple "build wrapper" plugin http://javadoc.jenkins-ci.org/hudson/tasks/BuildWrapper.Environment.html#tearDown(hudson.model.AbstractBuild, hudson.model.BuildListener)<http://javadoc.jenkins-ci.org/hudson/tasks/BuildWrapper.Environment.html#tearDown(hudson.model.AbstractBuild,%20hudson.model.BuildListener)>
/James From: jenkinsci-users@googlegroups.com [mailto:jenkinsci-users@googlegroups.com] On Behalf Of david.doug...@barclays.com Sent: 03 May 2013 14:48 To: jenkinsci-users@googlegroups.com Subject: RE: Execute Clean Up on Build Cancel You will probably need to do something with a groovy system script; that would interact with the JVM that Jenkins runs in, you might be able to extract the information about the calling job, slave it ran on, etc.? I can't recall if cancelling a job will generate the console log output on the Master (something worth checking), as that would contain the node which the job ran on. You could then do something with a rush/ssh (assuming you can deploy Cygwin or similar) to clean up the slave environment. dD From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com] On Behalf Of Paul Weiss Sent: 03 May 2013 13:45 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: Execute Clean Up on Build Cancel But how do you guarantee that the second job runs on the same slave as the first, unless you pin both jobs to a single slave? On May 3, 2013 12:12 AM, "Martin Ba" <0xcdcdc...@gmx.at<mailto:0xcdcdc...@gmx.at>> wrote: On 03.05.2013 03:36, Eric Blom wrote: Hello Everyone, We started using Jenkins about a year ago and have been very happy with it. We keep finding more way to use it! Some of our jobs use hardware connected to the slave and when that slave job is canceled we need to execute a clean up step, how can this be done? I'm looking for a solution for both Linux and Windows. On Linux I've tried using the trap command, but, I can't find any signal that trap can trap. On windows I haven't found any solution yet. ... Can anyone offer me some advice on how to implement a clean up on cancel for Linux and Windows? Idea: Move the cleanup to a second job that you run downstream from the first one. You start the second job always ("Complete (always trigger)") and it will run even when the first job was aborted. And if you use the parameterized trigger plugin and load the parameters for job#2 from a file, you can have it starting depend on the file existing. ("Don't trigger if any files are missing.") cheers, Martin -- 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments. Internet communications are not guaranteed to be secure or virus-free. The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons. Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group. Barclays Bank PLC.Registered in England and Wales (registered no. 1026167). Registered Office: 1 Churchill Place, London, E14 5HP, United Kingdom. Barclays Bank PLC is authorised and regulated by the Financial Services Authority. -- 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- 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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.