How do you specify which repository branch to use when a configuration is triggered by another another build?

Hi there!

I’m trying to set up a build trigger based on a different build succeeding. A bit of background info first: we have a SVN repository with multiple projects inside, each with its own branches. We were setting up configuration level repositories before, but Tech Support recommended we consolidate them into one repository per project with branches specified with regular expression to reduce their number. When a build is launched manually, it’s easy enough to pick the appropriate branch from the drop-down list. But how do I specify which branch to use when the build is triggered by a build trigger?

Let me know if you need more info.

Thanks!

Configure branch mappings - http://wiki.finalbuilder.com/display/continua/Repositories#Repositories-BranchMappings

This allows you setup default branch mappings, so when repo a builds branch a, repo b uses branch x

Thanks, totally missed that feature. Setting it up went fine, but it looks like when the second build ran, trolls ate my log page:
The web server reported the following error:
Exception: NullReferenceException
Message: Object reference not set to an instance of an object.
Stack Trace: at ASP._Page_Areas_CI_Views_builds__Layout_cshtml.Execute() in c:\Program Files\VSoft Technologies\ContinuaCI\Web\Areas\CI\Views\Builds_Layout.cshtml:line 10
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.b__6(TextWriter writer)
at System.Web.WebPages.WebPageBase.Write(HelperResult result)
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) <br> at System.Web.WebPages.WebPageBase.PopContext() <br> at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) <br> at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<invokeactionresultwithfilters>b__17() <br> at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I can see the build as “failed” in the list, but not open its details because of the 500 error above.

Hi Miruna,

We are in the process of fixing up some of these null exceptions in views which hide the underlying error.  There should however be another error in the Event Log page in the Adminstration section which provides more details? 

There’s nothing else in the application event log in the 20 seconds before or after this message. The Event log page in the Administration section has nothing in the past 3 weeks since we updated to build 1.8.0.201.

Hi Miruna,

The latest version just uploaded fixes the null checking on this page. Please install this and let us know if you now see an error?

Ok, new build gave me a more helpful error.

The web server reported the following error:
Exception: HttpException
Message: The “RenderBody” method has not been called for layout page “~/Areas/CI/Views/Builds/_Layout.cshtml”.
Stack Trace: at System.Web.WebPages.WebPageBase.VerifyRenderedBodyOrSections()
at System.Web.WebPages.WebPageBase.PopContext()
at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.b__6(TextWriter writer)
at System.Web.WebPages.WebPageBase.Write(HelperResult result)
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) <br> at System.Web.WebPages.WebPageBase.PopContext() <br> at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) <br> at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<invokeactionresultwithfilters>b__17() <br> at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Oh, actually, the error right before that gave me the cause: “The expression [%Workspace%\Reports\FBLog.html] contains errors: Unknown Variable : Workspace”. If I fix the typo’ed variable name to $Workspace$ in the report definition in the configuration, the log opens. If I change it back to %Workspace%, then the troll is back and the error in my previous post is logged to the application event log.

I have a feature request to go with this. Can the Event Log page use full datetimes rather than relative time? Correlating events is kind of obnoxious if they all say “3 minutes ago” because you have to open them all one by one and see that 2 of them were within a second of each other and are probably related, while the other 5 were 20-40 seconds later, hence probably not related. It would be a lot easier to see that from the event list if they had their datetime.

Hi Miruna,

Great that you have fixed this. We’ll update this page to handle this error better. I missed this eventually yesterday. 

The full date time is actually shown in the Event Log in grey under the relative time:



Maybe this is not displayed clearly in your browser?

Oh, sorry about that. I was looking at the private messages page, not the Event Log. We have it set up to send errors to admins as private messages and since the PM count shows on the navigation bar, it’s easier to access directly from there.

If you mouse over the relative date time in the private messages, the actual date time will be shown as a tool tip. This should apply to other places where relative date time is displayed. 

This is still not working for me. I have 2 repositories with 2 branches each. In Project A, with project-level repository A, I mapped branches so the trunk maps to the trunk in Repo B and Branch1 maps to Branch1 in Repo B. In project B, using Repo B, I have a configuration with a build trigger that waits for project A’s build to succeed.

When triggering a build for project A, I selected Branch 1 for Repo A, click the arrow to sync it so Repo B also shows its Branch1. When project B builds, it builds from the trunk instead of the specified branch.

Hi Miruna,

I think there was a bit of confusion here and Vincent didn’t realise you were referring to the Build Completed trigger. 

The configuration branch mappings only apply within a single configuration and define the branches to build in other repositories associated with the same configuration, based on the triggering repository branch.

There is currently no way to map branches from a repository in one configuration to branches triggered by a single Build Completed trigger in another configuration. We do have plans for a Dependencies feature which would including such mappings, but that is still a long way off.

To achieve the required functionality, at the moment, you would need to have one Build Completed trigger per branch. Tick “override repository branch mappings” in the trigger dialog, then specify a branch to build in the trigger Branch Mappings. Then add a trigger condition $Source.RepoA.Branch$ Equals “/branches/branch1/”. This trigger will only be executed when triggering configuration has been run on branch1 for RepoA. You will need to add another similar Build Completed trigger for every other branch. 

This is not ideal if your branches change a lot. The alternative is to combine the two build configurations, adding the actions from the second configuration as a separate stage.