Skip to content

Commit

Permalink
Skip web app deploy when name is unavailable (#10)
Browse files Browse the repository at this point in the history
* Skip web app deployment if name variable is not present

* Check empty string as well
  • Loading branch information
WimVergouwe authored Oct 28, 2021
1 parent 6dc219e commit c8d0beb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions azure/pipelines/deploy/web-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,24 @@ parameters:

steps:
- task: PowerShell@2
displayName: '${{ coalesce(parameters.label, parameters.module) }} - Check package existence'
displayName: '${{ coalesce(parameters.label, parameters.module) }} - Check preconditions'
inputs:
targetType: 'inline'
script: |
if (Test-Path '${{ parameters.package }}' -PathType Leaf) {
Write-Host "Deployment package exists."
Write-Host "##vso[task.setVariable variable=skipWebApp]false"
}
else {
If (-Not (Test-Path '${{ parameters.package }}' -PathType Leaf)) {
Write-Host "Deployment package doesn't exist."
Write-Host "##vso[task.setVariable variable=skipWebApp]true"
}
ElseIf (('${{ parameters.webApp }}' -like '$(*)') -Or ('${{ parameters.webApp }}' -eq '')) {
Write-Host "Web app name not set."
Write-Host "##vso[task.setVariable variable=skipWebApp]true"
}
Else {
Write-Host "Preconditions have been met to continue web app deployment."
Write-Host 'Deployment package: ''${{ parameters.package }}'''
Write-Host 'Web app name: ''${{ parameters.webApp }}'''
Write-Host "##vso[task.setVariable variable=skipWebApp]false"
}
- task: AzureRmWebAppDeployment@4
displayName: '${{ coalesce(parameters.label, parameters.module) }} - Deploy'
Expand Down

0 comments on commit c8d0beb

Please sign in to comment.