2

I'm creating a build/deploy script for our website. Our process currently is a bit convoluted as it requires to start website with a webconfig setup to update our schema. Then we switch off the site, change webconfig not to update schema anymore and we start it again.

Because of repetitiveness of tasks our -taskList couple of tasks more than once.

eg.

Invoke-Psake (Join-Path $env:currentDir "\tasks\iis_app_deploy.ps1") `
-taskList ValidateProperties,StopApplicationPool,<random stuff>,StartApplicationPool,StopApplicationPool,StartApplicationPool,PutBackInLoadBalancer

In this tasks list, each tasks gets excuted once and once only. Is there any way of specifying psake to run tasks without checking whether they have ran before or not?

Luke
  • 1,872
  • 20
  • 31

1 Answers1

1

I have found an answer to my own question. Nesting.

Those were the steps;

  1. Pull deployment process into smaller steps (in my case two)
  2. Create a wrapper Task
  3. Use Invoke-Psake in those to get it to work.

This is an example code;

task BackendDeployment -depends     ValidateProperties{
    # Deploy and update schema
    $self = Join-Path ($env:scriptPath) "tasks\iis_app_deploy.ps1"
    Write-Output "Running schema changes"
    Invoke-Psake $self  -TaskList   StopApplicationPool,`
                                    MSDeploy,`
                                    CopyLicenses,`
                                    CopyConfigs,`
                                    UpdateConfigForSchemaChanges,`
                                    StartApplicationPool,`
                                    WarmUpApplications, `
                                    WaitForAction `
                        -properties $properties
    Write-Output "Running final deployment"
    Invoke-Psake $self -TaskList    StopApplicationPool,`
                                    CopyConfigs,`
                                    StartApplicationPool,`
                                    WarmUpApplications `
                        -properties $properties
}
Luke
  • 1,872
  • 20
  • 31