The scenario: If "doSomething" fails then "waitforValidation" must run. After succeful validation then "doSomethingAfterValidation" must run.
But currently after succesful validation "doSomethingAfterValidation" is simply Skipped. If I remove "condition: failed()" and make "doSomething" succeed there is no problem.
Tried playing with conditions with no luck…
trigger:
- none
pool:
vmImage: ubuntu-latest
jobs:
- job: doSomething
displayName: Do Something
steps:
- script: script that will fail
displayName: 'Run a online script'
- job: waitforValidation
displayName: Wait for external validation
dependsOn: doSomething
condition: failed()
pool: server
timeoutInMinutes: 4320
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440
inputs:
notifyUsers: [email protected]
instructions: 'Please validate'
onTimeout: 'resume'
- job: doSomethingAfterValidation
displayName: do something after Validation
dependsOn: waitForValidation
steps:
- script: echo Extecuted after resume!
displayName: 'Run a script after manual validation'
2
Answers
The solution was to insert the condition
succeeded(‘waitForEvaluation’)
indoSomethingAfterValidation
. specifying the job in question. Since the dependencies are in the same dependency tree,succesful()
applies to all jobs. And since one fails, it will skipdoSomethingAfterValidation
. Not very logical IMO, but there it is.You could try to add the condition
succeededOrFailed()
for the jobdoSomethingAfterValidation
.The
succeededOrFailed
means that job will be executed even if a previous dependency has failed, unless the run was canceled.Please check the document Specify conditions for some more details.