Search code examples
azure-devopstfsbuildtfs-2015

TFS 2015. the $(var.SourceLocation) variable is not available at gated-check in


We are migrating from old XAML build definition to new TFS 2015 build. In old we have gated-check in that is working fine. In new one we have such option on "Triggers" tab. However I want use commit ID that trigger build. The variable $(Build.SourceVersion) is responsible for this, but for gated-check in it is not being set. It looks right, because commit was not accepted by TFS yet.

The question is how to grab this commit ID either during gated-check in or following CI ?

Should I create just another build for gated check-in that just compile our solution and only if succeeded will trigger CI ?


Solution

  • So far, I end up with not clean workaround, but it were accepted by our management. I created two build definitions: one for gated-check in, one for CI. Once someone checked in something gated check-in fires. If it completed successfully, CI build would be triggered. Please note corresponding checkbox on UI:

    gated CI

    This is not so clean solution, but it works for me.