I am trying to add an approval job based on the stage, I am using a template and want to skip approval for some stages:
parameters:
- name: Stage
type: string
- name: Environment
type: string
- name: WebAppName
type: string
- name: ArtifactName
type: string
- name: DependsOn
type: object
default: []
- name: Subscription
type: string
- name: isApproval
type: boolean
default: false
stages:
############################################################
# Deploy stages
############################################################
- stage: ${{ parameters.Stage }}
displayName: '${{ parameters.Stage }} Stage'
dependsOn: '${{ parameters.DependsOn }}' # this will execute based on the stage that is passed.
jobs:
- job: approval
condition: eq('${{ parameters.isApproval }}', true)
pool:
vmImage: 'windows-latest'
steps:
- task: ManualIntervention@8
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
emailRecipients: 'example@example.com'
instructions: 'Please validate the build configuration and resume'
- deployment: ${{ parameters.Environment }}
${{ if eq('${{ parameters.isApproval }}', true)}}:
dependsOn: approval
timeoutInMinutes: 70
environment: '${{ parameters.Environment }} Environment'
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: ${{ parameters.ArtifactName }}
downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: ${{ parameters.Subscription }}
appType: 'webApp'
WebAppName: ${{ parameters.WebAppName }}
package: '$(System.ArtifactsDirectory)/**/*.zip'
And now from the release pipeline, I am passing values to the template:
- template: stages\deploy.yml
parameters:
Environment: 'Dev'
WebAppName: 'azureappservicehelloworldapp-dev'
Stage: 'Dev'
ArtifactName : '$(ArtifactName)'
Subscription: 'AzureConnectionSC'
# empty DependsOn, as Dev depends on nothing
DependsOn:
- Build
- template: stages\deploy.yml
parameters:
Environment: 'UAT'
WebAppName: 'azureappservicehelloworld-uat'
Stage: 'UAT'
ArtifactName : '$(ArtifactName)'
Subscription: 'AzureConnectionSC'
DependsOn:
- Dev
isApproval: true
- template: stages\deploy.yml
parameters:
Environment: 'Prod'
WebAppName: 'azureappservicehelloworld'
Stage: 'Prod'
ArtifactName : '$(ArtifactName)'
Subscription: 'AzureConnectionSC'
DependsOn:
- UAT
isApproval: true
If you see IsApproval is sent as true from UAT & Prod templates, so I should be able to validate approval for UAT & prod and DEV should be deployed without any approval.
But I am getting the below error for the approval job in the template:
Manual intervention task is giving error, any suggestions plz.