Short Version:
I am setting the Status=Failed and TestStatus = Failed on a custom build template (.xaml). When the build is setup as a Gated Check In (CheckIn), the code still commits.
Long Version:
I have some custom logic in the build workflow that is setting the below properties.
<!--the below is a result if a custom code activity I wrote returns a "true" for Code Coverage being lower than expected -->
<mtbwa:SetBuildProperties DisplayName="Set Status and TestStatus to Failed" Status="[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed]" sap2010:WorkflowViewState.IdRef="SetBuildProperties_7" />
My build "goes orange", but the code still gets checked in. The check-in of the code is the undesired result.
Some other "setup" screens:
Other articles I found:
TFS Gated check-in -- How to reject check-in on Partial Build Success?
Fail a build if code coverage is below a threshold in TFS2012
APPEND:
My template was from a Microsoft default one.
My custom check is defined between
If CompilationStatus = Unknown
and
If TestStatus = Unknown