We’ve been using Octopus deploy to install builds to our test servers running Windows Server 2008 for a few months now and everything has been working fine. Our main installation routine consists of running a batch file that copies files and sets up some IIS stuff and does various other things to get our application working. We also use the same batch file when our application is being manually deployed to customer sites (we can’t use Octopus on the customer sites unfortunately). Because of the fact that the batch file is run manually there are some Pause statements in it so that our deployment engineers can check things before continuing with the deployment.
The fact that there are Pause statements in the batch file has never been an issue before with Octopus when running the deployments on Server 2008 machines, Octopus just carries on without actually pausing.
We’ve now set up some Server 2012 machines that we need to deploy to through Octopus and I’ve just run the first deployment and Octopus seems to have actually paused at the pause statements!
Does anyone know if there’s something I need to configure in Windows to stop this happening? Or is it possible that its an issue with Octopus? Or is it something that’s just inherent with Server 2012 that cant be changed?
Any help with this would be greatly appreciated as it could be a major problem for us using Octopus with Server 2012 machines
Forgot to mention that we’re currently running Octopus V3.4.12 with all tentacles running the same version.
I’ve just set up a small test to make sure that there’s nothing else in our deployment or in the batch file that could be causing this issue and I’ve managed to reproduce the issue.
So what I’ve done is I’ve created a batch file and put it in c:\temp on one of the Server 2012 machines and on one of the Server 2008 machines. This is the contents of the batch file:
@ echo off
Echo This is a test batch file to test Pause on Server 2012
Echo doing something
Echo about to pause…
Echo got past the pause, hooray!
I’ve then gone into the script console on Octopus and run the following as a Powershell command, running it against the Server 2008 machine as the target and then running it against the Server 2012 machine as the target
cmd.exe /c ‘Test.bat’
When running on Server 2008 the batch file completes successfully, getting past the pause as expected. When running on Server 2012 the batch file hangs at the Pause command.
Thanks for getting in touch! I’ve had a hunt around and can’t find anything definitive as to why
pause would pause on Server 2012, but not on Server 2008.
I would assume the
pause statement was to keep the command-line open when running the batch file locally? One suggestion would be to detect if the batch file was run interactively or pass a specific parameter from PowerShell to the batch file after detecting whether PowerShell was called interactively.
Sorry I don’t have a clear answer for you, and both of these suggestions aren’t amazing. I would personally avoid the pause in the batch file altogether, and try to come up with another way to meet your needs.
Hope that helps!