diff --git a/azure/pipelines/deploy/web-app.yml b/azure/pipelines/deploy/web-app.yml index ae80a14..8a211dc 100644 --- a/azure/pipelines/deploy/web-app.yml +++ b/azure/pipelines/deploy/web-app.yml @@ -31,10 +31,14 @@ parameters: type: string displayName: "Optional label to prefix steps in pipeline." default: -- name: postDeploySteps +- name: postStagingSteps type: stepList default: [] - displayName: "Optional steps to execute after the deploy, before swapping slots (e.g. smoke testing)." + displayName: "Optional steps to execute after staging slot deploy, before swapping slots (e.g. smoke testing)." +- name: postDeploySteps + type: stepList + default: [] + displayName: "Optional steps to execute after production slot deploy, before cleaning up the old slot (when applicable)." steps: - task: PowerShell@2 @@ -67,10 +71,14 @@ steps: TakeAppOfflineFlag: false condition: and(succeeded(), ne(variables['skipWebApp'], 'true')) -- ${{ each step in parameters.postDeploySteps }}: - - ${{ step }} - +- ${{ if and(parameters.webAppSlot, eq(parameters.webAppSlot, 'production')) }}: + - ${{ each step in parameters.postDeploySteps }}: + - ${{ step }} + - ${{ if and(parameters.webAppSlot, ne(parameters.webAppSlot, 'production')) }}: + - ${{ each step in parameters.postStagingSteps }}: + - ${{ step }} + - task: AzureAppServiceManage@0 displayName: '${{ coalesce(parameters.label, parameters.module) }} - Swap slots' inputs: @@ -81,6 +89,9 @@ steps: SourceSlot: ${{ parameters.webAppSlot }} condition: and(succeeded(), ne(variables['skipWebApp'], 'true'), ne(variables['${{ parameters.variablePrefix }}${{ parameters.module }}WebAppSlot'], 'production')) + - ${{ each step in parameters.postDeploySteps }}: + - ${{ step }} + - task: AzureAppServiceManage@0 displayName: '${{ coalesce(parameters.label, parameters.module) }} - Remove slot' inputs: