A question we often get asked, is "which files triggered my build?". In FinalBuilder Server 6.2, we add The Build Overview Page.

The Version Control Changes listed on the build overview are passed to FB when FB Server starts a build. At the moment, this collection of files is only available via scripting. We had intended to make them available as a built in FileSet, however FileSets don't have custom properties, so they were not a good fit.

Using the Trigger Files collection from script is quite easy :


The source of the Trigger Files collection comes from getting the repository history, and parsing the output. The possible values of the item properties depends on the the version control system you are using. For example, with Subversion the Version property will have the Repository Revision Number, whereas with Surround it will show the File Revision Number.

Using subversion as an example again, say we wanted to know the highest Revision number of the svn commit that triggered out build (JavaScript) :

FBVariables.SVNVersion = 0;
for (var i = 0; i < FBTriggerFiles.Count; i++)
  if (FBTriggerFiles.Item(i).Version > FBVariables.SVNVersion)
    FBVariables.SVNVersion = FBTriggerFiles.Items(i).Version;

In the above example, our FB Project variable SVNVersion now contains the value we are interested in. This can then be used to form our version numbering for our build. The caveat for this technique is that if the build was started manually by a user, or started by a time based trigger then the FBTriggerFiles collection will be empty. In that case you will need to deal with it if you still want to use version control revision numbers as a source of version numbers (for example run the svn Info action if the collection is empty).


Actions: E-mail | Permalink |