Scripts/StepCleanup.ps1

function CleanupAction {
    Param(
        [System.Object] [Parameter(Mandatory = $true)] $Conn,
        [string] [Parameter(Mandatory = $true)] $PipelinePath,
        [string] [Parameter(Mandatory = $true)] $SolutionFolder,
        [string] [Parameter(Mandatory = $true)] $SolutionName,
        [string] [Parameter(Mandatory = $true)] $EnvironmentName,
        [bool] [Parameter(Mandatory = $true)] $RunLocally
    )

    if (Test-Path -Path $PipelinePath\$SolutionFolder\Scripts\CleanupAction.ps1) {
        Write-PPDOMessage "**************************************************** CLEANUP START"
        Write-PPDOMessage "Execute Solution CleanupAction from $PipelinePath\$SolutionFolder\Scripts" -Type section -RunLocally $RunLocally
        . $PipelinePath\$SolutionFolder\Scripts\CleanupAction.ps1 -Conn $Conn -EnvironmentName $EnvironmentName -Path "$PipelinePath\$SolutionFolder\"
        Write-PPDOMessage "**************************************************** CLEANUP END"
    }
    else {
        Write-PPDOMessage "Deployment CleanupAction for $($EnvironmentName) step not registered to excecute" -Type warning -RunLocally $RunLocally
    }
}