3

I am trying to create a Visual Studio Team Services Extension Task for my builds and releases. I need a task that will send out an alert to another system if a previous task (including the default build/test/publish/etc.) fails.

I have already created the task to send the alert. However I do not see a way to kick off the task only if my build fails.

Is there a way in VSTS to run a task if a previous task fails, but not run it if all other tasks were successful?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Dan
  • 43
  • 5

2 Answers2

3

It is now possible to select a running condition for all tasks with the following possible values:

  • Only when all previous tasks have succeeded
  • Even if a previous task has failed, unless the build was canceled
  • Even if a previous task has failed, even if the build was canceled
  • Only when a previous task has failed
  • Custom conditions

"Only when a previous task has failed" condition selected

EDIT:
It is currently part of a preview, you can enable it through the "Preview features" menu after you click on your profile click on VSTS:
Profile menu

And activate the "New Build Editor":
Preview features menu

Jérémie Bertrand
  • 3,025
  • 3
  • 44
  • 53
  • 1
    What version of TFS online is this for? I do not see this as an option. – JCisar May 11 '17 at 16:24
  • I forgot to said that it is part of a preview, you can enable it through the "Preview features" menu after you click on your profile click on VSTS and activate "New Build Editor". – Jérémie Bertrand May 12 '17 at 04:00
2

There is no built-in feature.

But you can use the "Rollback" task from the Release Management Utilities to run a powershell script on failure.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341