Excellent suggestion.  And the "race condition" the plugin mentions is 
exactly what was happening.

We are running VMware VM's via vSphere Cloud plugin.  And our jobs are set 
to shutdown and revert.  But, if a job HAPPENS to grab the VM before it 
shuts down, it keeps running and tries to run a job on a dirty VM!

Thanks.

On Friday, November 10, 2017 at 11:28:02 AM UTC-5, Andrew Grimberg wrote:

> On 11/10/2017 08:13 AM, john.peterson wrote: 
> > We have been using PostBuild Script to execute the following command on 
> > the remote machine (as Build Steps > Execute Windows Batch Command): 
> > 
> > Shutdown  -s  -t:0     (I think I have that correct) 
> > 
> > We have to do this to make sure that NO MATTER WHAT our remote PC (VM) 
> > is shutdown, otherwise, occasionally, a queued script will begin 
> > execution on the already open VM. 
> > 
> > How can we do this and NOT use the PostBuild Script plugin? 
> > 
> > We were running 1.58 in the past and are just now updating to 2.87 
>
> Greetings John, 
>
> For us, we keep a copy of the plugin around and upload it to new Jenkins 
> instances that we stand up as we have some very specific uses of it that 
> none of the other plugins handle and our jobs are all under code review 
> via Jenkins Job Builder so we know that no malicious extras are showing 
> up in the post script. 
>
> For your use case though, I might suggest the following additional plugin: 
>
> https://wiki.jenkins.io/display/JENKINS/Single+Use+Slave+Plugin 
>
> That will allow you to make your instances single use, but you do still 
> need to have a way of cleaning up any now offlined systems. 
>
> If you're doing dynamic build instances via JClouds (or the OpenStack 
> plugin), each job has the ability to define a build node be single-use. 
> The plugin will properly reap out instances that have been used once 
> when doing this. 
>
> From personal experience, if you're using the EC2 plugin, this doesn't 
> work, I've got a cron hack that I've got in place that makes use of the 
> Single Use Slave Plugin and some custom groovy and awscli to get similar 
> functionality as the the JClouds (which I would be using for EC2 but 
> it's failing to handle a configuration properly) and OpenStack plugins. 
>
> -Andy- 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9a1cf854-6a7e-4988-8118-b1ef9d4faaef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to