Tuesday, 18 September 2012

Deployment on a schedule

The automated deployment that we're currently using has only ever been invoked by an end-user with an open powershell prompt.

The commands we invoke manually to publish our platform are:

Get-LatestBuild | Publish-Platform -environment "uat" -all -cleanFirst

Using Windows Task Scheduler

In order to provide our test teams with an up-to-date test environment each day, we've created an early morning scheduled deployment to the UAT environment.

The task's action command is relative simple. It's just packaging the above commands into a command line call.

powershell.exe -command {Set-Location D:\; Get-LatestBuild | Publish-Platform -environment "uat" -all -clean -goldData}

Took a little while to understand and get the syntax just right, so I thought I'd share it. 

Be aware of "Start Location"

You might set the Start Location of the scheduled task to where you want it to be, but Powershell.exe doesn't care, your powershell host once opened will start at its default location.

For this reason, I added an additional step to set the powershell environment location first;

Hope this helps,