Can SubWCRev still be used to update files with Continua?


We currently using a combination of Finalbuilder 7 and Finalbuilder Server 7 for our continuous integration builds and we use subversion as our source control.
Our current Finalbuilder projects relies  on the tortoisesvn SubWCRev command line tool to convert a ‘version.in’ file to ‘version.cs’ (updating information like the revision and date).

It seems that the synced source on the agent side does not have the subversion hidden folders (which makes sense) which means that attempting to use ‘subwcrec’ fails. Is there a way to use ‘SubWCRev’ within Continua? What would be the recommended approach for updating version information within Continua?

Thanks,

Simon Kennedy

Hi Simon,

We expose details of the latest changeset for each repository to the build using expression objects such as $Source.RepoName.LatestChangeset.Id$ $Source.RepoName.LatestChangeset.Created$.
  
These can be used in the AssemblyInfo Updater action to update SharedAssemblyInfo.cs or passed an Execute Program action, Run Dos command action or FinalBuilder action to update other files. We generally use a combination of build version and branch e.g. $Build.Version.DotNet$-$Source.CT_Source.Branch$" 

Thanks, I read up on powershell and created a script to perform the same task. See below:

param([string]$filepath, [int]$revisionNumber, [Datetime]$builddate, [string]$outfilepath) 

Function WriteUpdatedVersionFile 
{ 
(Get-Content $filepath) -replace ‘$WCREV$’, $revisionNumber <br> -replace '\$WCNOW\$', (Get-Date) 
-replace ‘$WCDATE$’, ($builddate) ` 
| Out-File $outfilepath 
} 

if (Test-Path $outfilepath) 
{ 
$filepathdate =  (Get-ItemProperty -Path $filepath -Name LastWriteTime).lastwritetime 
$outfilepathdate =  (Get-ItemProperty -Path $outfilepath -Name LastWriteTime).lastwritetime 

echo $filepathdate 
echo $outfilepathdate 

if ($filepathdate -gt $outfilepathdate) 
{ 
echo “Out of date” 

WriteUpdatedVersionFile 
} 
else 
{ 
echo “Up to date” 
} 
} 
else 
{ 
echo “File does not exist” 

WriteUpdatedVersionFile 
}

Sweet, good stuff Simon


Thanks Pete,

I have a few questions related to your response.

1) Does the exit codes also apply to the ‘Powershell’ action?
2) I followed the ‘Custom+Log+Messages’ but its not clear how these messages are used (is there a specific ‘action’)?
3) The ‘Expression-Objects’ page does not define things like stage status/outcome. Is there pre-defined variables for this?

Thanks,

Simon Kennedy

Hi.

1) Evaluating exit codes for the Powershell Continua action is not currently a feature. However can be done simply with a run batch action. You can test this out by:

create a powershell script and commit it to your repo: test.ps1:

Write-Host "This is my cool exit code: 12345"exit 12345 


Run it with a batch execute action: PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy unrestricted -File “.\test.ps1”
Working Directory: $Source.YOURREPONAME$

The exit code returned from this command will be 12345.

An example of this:



2) Sorry, not sure what you refer to in this question.

I was suggesting you might be interested in an alternative to your “echo” statements. Doing something like:

#Start a log message groupWrite-Host “@@continua[startGroup value=‘Doing some work’ ]”# do some work here, log  messages etc, eg:Write-Host “@@continua[message value=‘This is an information message that will be logged into the Continua log’ ]”#Finish the log message groupWrite-Host "@@continua[endGroup value=‘Doing some work’ ]"


These messages will appear within the Continua build log.

3) That’s right, once a stage (or stage gate) has failed the build has failed, no further stages / actions can be run (with the exception of build event handlers if any). As a result we have no stage status variables as they could never be used.

I’m unclear as to what your outcomes are, however have a look over the try / catch actions (http://wiki.finalbuilder.com/display/continua/Try%2C+Catch+and+Finally+Actions).


Thanks Pete,

Your answer for question #1 was exactly what I wanted.

In regards to question #2 that was what I was looking for (the help does not contain any context for where/how you use the ‘@@’ syntax.

In regards to question #3 I would like to add an action to my configuration that updates slack through its web API (I have a powershell script
that can do it). I’m guessing that I have to use a ‘try/catch’ around my actions to-do this.


  1. No worries.
    2) No worries. Will look to see how we can improve this area of the doco.
    3) Looks like try / catch / finally actions will do what your after for this one Setting variables / etc as required.