Search code examples
tfstfsbuild

How to skip a build task/step instead of disable it in TFS vNext build definition?


A totally newly guy to SO, and forgive my poor English.

We are working on TFS could. My team has a very large build definition including multiple tasks. In the past, we had a copy of the main definition and disable some tasks we don't need ,then run it in our sub-team, which works perfectly.

However, due to company's policy, every build need to be run on the main definition now. If we still disable some tasks, it will change the definition in TFS could. Which means other sub-teams will also be effected. But we also don't want to run the overall tasks. It took so long time and will raise the risk of failure.

Is there a way to figure this out?

Thanks


Solution

  • You could specify conditions for running a task for now:

    • 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

    If the built-in conditions don't meet your needs, then you can specify custom conditions.

    Express the condition as a nested set of functions. The agent evaluates the innermost function and works its way out. The final result is a boolean value that determines if the task is run or not.

    Note: If the TFS cloud you mentioned above is VSTS, you could directly use this. Otherwise for on-premise server, this feature will be available only in TFS 2017 Update 2 and above.