What does $Source$ expand too?


One of the more annoying things I’ve run into when evaluating Continua is having to guess what something expands to because the actual run of a configuration does NOT expand
variables like ‘$source$’.

I have added a configuration repository ‘trunk’ which points to the root of our application subversion tree and then monitors ‘trunk’. The default
repository rule for an added stage is ‘$source$ > source’ and that works fine (though it does not expand so I don’t know the path its checking out
 from.

I wanted to only checkout a subset of this so I tried $source.trunk$\BuildProjects > source but the message in the log simply prints:

Repository Syncing
Using UNC Transport.
$Source.trunk$\BuildProjects > C:\Users\Public\ContinuaAgentWorkspace\Ws\54\Source\BuildProjects
0 files

Problem is I have no idea what $Source.trunk$ is actually expanding to and I’ve tried multiple combinations and nothing seems to work.

Is there a way to know what ‘$source.trunk$’ expands to that does not involve trial and error? 

Simon Kennedy


I noticed that when each build runs I get the following error logged in the event log (but it does not appear in the build log):

A new event has been added to the event log:

Stage Controller

There was an error with stage: Build. Message: An error occurred while syncing files from the server to the agent. Details: Exception: NullReferenceException
Message: Object reference not set to an instance of an object.
Stack Trace: at Continua.Shared.Utils.FileMatcher.b__1(String x)
at System.Linq.Enumerable.WhereListIterator1.MoveNext() <br> at Continua.Shared.Utils.FileMatcher.ParsePatterns(IEnumerable1 patterns)
at Continua.Shared.Utils.FileMatcher.GetMatches(IEnumerable1 patterns) <br> at Continua.Modules.Builds.Agent.FileSync.UNCTransport.Copy(String destination, String pattern, IEnumerable1 excludes, String basePath, RuleOperator op, Int32& filesCounted)
at Continua.Modules.Builds.Agent.FileSync.UNCTransport.ExecuteAgentToServerRule(String source, IEnumerable1 excludeRules, WorkspaceRuleDTO rule) <br> at Continua.Modules.Builds.Agent.FileSync.UNCTransport.CopyFilesFromAgentToServer(String source, IEnumerable1 rules)
at Continua.Modules.Builds.Agent.AgentBuildHelper.SyncWorkspaceToServer(TransportContextDTO context, IEnumerable1 rules, AgentWorkspaceSyncContext workspaceCtx) <br> at Continua.Modules.Builds.Agent.AgentBuildRunner.OnSyncingWorkspace(Transition1 inState)

$Source$ is a shortcut for repository rules only. http://wiki.finalbuilder.com/display/continua/Repository+Rules

Do you actually have a repository called trunk ?

The typical pattern is

$Source.RepositoryName$\Folder** > \Source\WhereEver

The default rule is copy all repos for the config

$Source$ > Source

The would expand (on the agent) to

\Source\Repo1
\Source\Repo2


What Workspace rules do you have? We would need to see that to be able to reproduce the error.


I have a repository configuration called ‘trunk’ (subversion).
The repository url is: http://…/product.
We are monitoring a ‘single branch’ with a default path of ‘/trunk/’. The url is: http://…/product/trunk.
I would like the repository rules to only sync a ‘BuildProjects’ subdirectory with the url: http://…/product/trunk/BuildProjects.

The repository rules for the build configuration look like this:

#Source rules
#---------------------------------------------------
#export all source to agent workspace
$Source.trunk$\BuildProjects > Source\BuildProjects

#---------------------------------------------------

This syncs ‘0’ files! (And generates an error that I described in my previous message).

Change the rule to this :

$Source.trunk$\BuildProjects** > Source\BuildProjects

Note that due to a limitation with the mercurial archive function (we use mercurial for our repo caches) the structure of the repo cannot be altered in the rules, so you would probably end up with Source\BuildProjects\BuildProjects… using that rule.

As for the error, looking at the stack trace suggests to me that the error comes from the Workspace rules for syncing the agent workspace back to the server, which is why I asked about them.


Thanks Vincent,

I replaced the rule with $Source.trunk$\BuildProjects** > Source and now I get what I expected.

I find that I still don’t quite understand how these variables expand/work. I’ve now updated the repository rules to be this:

$Source.trunk$ > Source
-$Source.trunk$\Help > Source
-$Source.trunk$\Help Flare > Source
-$Source.trunk$\UI Tests > Source
-$Source.trunk$\Documentation > Source

The documentation seems to be saying that using ‘-’ will excluded those folders.
However it still appears that the configuration is syncing the ‘Help’, ‘Help Flare’, ‘UI Tests’ and ‘Documention’ folders.
What am I doing wrong here? Does it process them in order? Do I have to-do this with multiple repository configurations?

I’m looking into this now. I’ve not used the exclude rules myself in some time, and they don’t seem very obvious to use (doco could use some clarification).

Ok, this should work :

$Source.trunk$ > Source
-$Source.trunk$\Help** > Source
-$Source.trunk$\Help Flare** > Source
-$Source.trunk$\UI Tests** > Source
-$Source.trunk$\Documentation** > Source

The doco definitely needs a rewrite. Exclude patterns are combined with the include ones by matching the Agent (right hand) side. I suspect this is to allow for something like this

$Source.trunk$ > Source
-$Source.trunk$\Help** > Source

$Source.trunk$ > Doco
-$Source.trunk$\Src** > Doco

I know we have discussed some feature work around this area to make it easier to generate the rules (some sort of rule builder ui that looks at the repo structure).


Thanks Vincent! That seems to be working and shaves off ~2 mins.