21

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

 

Post Rating

Comments

#
Thursday, December 17, 2009 3:00 AM
What is the action Misc->Trigger Files Iterator for? Is it a replacement for the above?
vincent
# vincent
Thursday, December 17, 2009 3:46 AM
Not a replacement, just an easier way to achieve the same thing. Some users don't like using script, and in fact if we can provide a way to do something in FinalBuilder without using script then that is the preferred option.

Post Comment

Only registered users may post comments.