skip to Main Content

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


  1. Chosen as BEST ANSWER

    The solution was to insert the condition succeeded(‘waitForEvaluation’) in doSomethingAfterValidation. 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 skip doSomethingAfterValidation. Not very logical IMO, but there it is.


  2. Job is not run after Manual Validation

    You could try to add the condition succeededOrFailed() for the job doSomethingAfterValidation.

    - job: doSomethingAfterValidation
      displayName: do something after Validation
      dependsOn: waitForValidation
      condition: succeededOrFailed()
      steps:
      - script: echo Extecuted after resume!
        displayName: 'Run a script after manual validation'
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search