I have an Azure DevOps build pipeline implemented in YAML, and the pipeline contains unit tests. If a unit test fails, the build fails - so far so good.
Given that the pipeline is in the same repo as the code, developers are free to modify it as they wish.
Sometimes developers are lazy or in hurry and prefer to get rid of the failing unit tests instead of fixing them. How can I ensure that developers do not remove the unit test build task from the YAML pipeline?
In TeamCity I would add a build failure condition that would compare the number of unit tests in the current build with the previous build, and if it (significantly) drops, it would fail the build. Is there a similar option in Azure DevOps?
Write-Host ##so[task.setvariable...
that let's you do that. By using that you might be able to directly set the build status to failed. – DanDan