I am developing an Azure CD YAML pipeline to deploy the result of a CI pipeline onto a Virtual Machine. Right now and simplifying things a little for the purpose of this post, the CD pipeline is quite simple and consist of a single stage with 3 jobs:
- The first job runs scripts to stop a somehow complex applications. This can sometimes fail.
- The second job will only run if first job fails. This to give the opportunity for an administrator to do a manual intervention (leveraging the built-in Manual Validation task) and fix the issue encountered in the first job. If the administrator is happy to continue to run the deployment pipeline, he will resume the run of the pipeline.
- The third step is the deployment of the new version of the application.
Here is the overall structure of the YAML pipeline:
jobs:
- deployment: StopApplication
environment:
name: 'EnvA' # This environment is a set of virtual machines running self-hosted Azure Agents.
resourceType: VirtualMachine
strategy:
rolling:
maxParallel: 1
deploy:
steps:
- task: ...
- job: ManualIntervation
displayName: Manual intervention to fix issue while stopping application
pool: server
dependsOn: StopApplication
condition: failed() # This job will run only if job StopApplication has failed.
timeoutInMinutes: 60
steps:
- task: ManualValidation@0
timeoutInMinutes: 50
inputs:
notifyUsers:
[email protected]
instructions: 'Do something'
onTimeout: 'reject'
- deployment: DeployApp
dependsOn:
- StopApplication
- ManualIntervation
condition: xor(succeeded('StopApplication'), succeeded('ManualIntervation'))
workspace:
clean: all
environment:
name: 'EnvA' # This environment is a set of virtual machines running self-hosted Azure Agents.
resourceType: VirtualMachine
strategy:
rolling:
maxParallel: 1
deploy:
steps:
- task: ...
The problem I have is that if the first deployment job fails but that the administrator review the problem, fixes it, resume the run of the pipeline and that the last deployment job succeeds, Azure DevOps shows my pipeline as Failed (red cross in the DevOps portal) which I can understand as one of the jobs failed. Nevertheless, functionally, the deployment succeeded and so I would like to set/force the result of the pipeline run as a success so that Azure DevOps display the green check.
Does anyone know the way to achieve this? I would assume that it is possible otherwise I would not understand why we have the opportunity for manual interventions in a pipeline.
