场景:If "doSomething"不那么"waitforValidation"必须运行。验证成功后,"dosomethingaftervalidation";必须运行。但目前在验证成功后,doSomethingAfterValidation"只是被跳过了。如果我删除"condition: failed()"并"做某事";成功没有问题。试着玩条件没有运气…
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: x@x.com
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'
作业在手动验证后未运行
您可以尝试为作业doSomethingAfterValidation
添加条件succeededOrFailed()
。
- job: doSomethingAfterValidation
displayName: do something after Validation
dependsOn: waitForValidation
condition: succeededOrFailed()
steps:
- script: echo Extecuted after resume!
displayName: 'Run a script after manual validation'
succeededOrFailed
表示即使之前的依赖项失败,作业也将被执行,除非运行被取消。
请查看文档指定条件以了解更多细节。
解决方法是在doSomethingAfterValidation
中插入条件succeeded(‘waitForEvaluation’)
。指定有问题的工作。由于依赖项位于同一依赖树中,因此succesful()
适用于所有作业。由于其中一个失败,它将跳过doSomethingAfterValidation
。在我看来不太合乎逻辑,但就是这样。