We want to trigger a CI build after a gated checkin because we have two builds in our company. One with a gated checkin for fast building and very important test. The other build is for code analysis and long running tests. Because we don’t want to wait very long on our CI build we have created that QM build. The problem is that the QM isn’t triggered anymore after changing the CI build to a Gated checkin build.
I found a blogpost for TFS 2010. Because TFS 2013 is slightly different, I thought I would give it an update.
This is how to fix it for TFS 2013
- Create an argument called “NoCIOption” of the type boolean with default True.
- Set the metadata information so you understand the argument in your build definition.
- Use the argument in the TFS 2013 build template. You can find the property under “Run on agent” and then “Get sources from Team Foundation Version Control”. Go to the properties window and change the hard coded “True” in the NoCIOption property to the argument you just created.
Now checkin your changes of the teamplate and use (if you don’t already have) the template in your CI build (the one with the gated checkin). Change the new argument to “false”.
Now your second build (our QM) is also triggered again.
6 thoughts to “Trigger a CI build after a gated checkin”
I get below error on following the steps mentioned above. Could you please help me with the same ?
TF215097: An error occurred while initializing a build for build definition :
Exception Message: Cannot set unknown member ‘Microsoft.TeamFoundation.Build.Activities.TeamFoundation.TfGetSources.NoCIOption’. (type XamlObjectWriterException)
Exception Stack Trace: at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Activities.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.ValidateWorkflow(Activity activity, ValidationSettings validationSettings)
at Microsoft.TeamFoundation.Build.Hosting.BuildProcessCache.LoadFromXaml(String workflowXaml, TextExpressionImports textExpressionImports)
at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest request, WorkflowManagerActivity activity, BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken)
Is the spelling right? Check for case sensitive.
Yes, the spelling is right in every respect.
Hi Sumeet. When the NoCIOption-property can not be resolved, it probably has something to do with the related assembly not being loaded properly. I just looked at my build-template and perhaps you should check yours if it adheres to t his as well:
– Within the AgentScope, there is a TfGetSources tag with the new NOCIOption attribute. Mine looks like this:
– As you can see from the snippet above, it is referencing the mtbat namespace, which should be defined in the template as well. In my case, this is how it is referenced:
– The assembly mentioned (Microsoft.TeamFoundation.Build.Activities.dll) should be for version 184.108.40.206 and has to be referenced in your Templates-project. Also, that specific assembly must be available in your CustomAssemblies folder that you specify on your build-controller. Are you sure you have added it? See the following illustration for defining custom-assembly path on your controller(s). http://www.software-architects.com/media/9c5398af-5ec0-418b-af21-471e7a11d4d7/FaBz7Q/time_cockpit/blog/2013/06/tfservice-version-control-path.png
I am not able to paste XAML-snippets but I tried to add the following XAML-snippet in my previous post:
mtbat:TfGetSources CleanWorkspace=”[CleanWorkspace]” CreateLabel=”[CreateLabel]” DisplayName=”Get sources from Team Foundation Version Control” Enabled=”True” sap2010:WorkflowViewState.IdRef=”TfGetSources_1″ NoCIOption=”[NoCIOption]” VersionOverride=”[GetVersion]”
Great guide. Thanks!