# What does $Source$ expand too?

**URL:** <https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268>\
**Category:** Discussion\
**Created:** [November 10, 2014, 7:59am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268 "2014-11-10T07:59:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [November 10, 2014, 7:59am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/1 "2014-11-10T07:59:40Z")

</div>

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  
&nbsp;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?&nbsp;  
  
Simon Kennedy

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [November 10, 2014, 8:11am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/2 "2014-11-10T08:11:33Z")

</div>

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.WhereListIterator`1.MoveNext() <br> at Continua.Shared.Utils.FileMatcher.ParsePatterns(IEnumerable`1 patterns)   
 at Continua.Shared.Utils.FileMatcher.GetMatches(IEnumerable`1 patterns) <br> at Continua.Modules.Builds.Agent.FileSync.UNCTransport.Copy(String destination, String pattern, IEnumerable`1 excludes, String basePath, RuleOperator op, Int32& filesCounted)   
 at Continua.Modules.Builds.Agent.FileSync.UNCTransport.ExecuteAgentToServerRule(String source, IEnumerable`1 excludeRules, WorkspaceRuleDTO rule) <br> at Continua.Modules.Builds.Agent.FileSync.UNCTransport.CopyFilesFromAgentToServer(String source, IEnumerable`1 rules)   
 at Continua.Modules.Builds.Agent.AgentBuildHelper.SyncWorkspaceToServer(TransportContextDTO context, IEnumerable`1 rules, AgentWorkspaceSyncContext workspaceCtx) <br> at Continua.Modules.Builds.Agent.AgentBuildRunner.OnSyncingWorkspace(Transition`1 inState)

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 10, 2014, 9:21am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/3 "2014-11-10T09:21:37Z")

</div>

$Source$ is a shortcut for repository rules only. [http://wiki.finalbuilder.com/display/continua/Repository+Rules](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   
 …

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 10, 2014, 9:22am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/4 "2014-11-10T09:22:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [November 10, 2014, 11:19am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/5 "2014-11-10T11:19:33Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 10, 2014, 12:08pm UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/6 "2014-11-10T12:08:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [November 11, 2014, 12:42pm UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/7 "2014-11-11T12:42:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 11, 2014, 1:57am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/8 "2014-11-11T01:57:46Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 11, 2014, 2:42am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/9 "2014-11-11T02:42:57Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [November 11, 2014, 5:48am UTC](https://www.finalbuilder.com/forums/t/what-does-source-expand-too/5268/10 "2014-11-11T05:48:37Z")

</div>

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