Property expansion for command line runner builds

'lo

I'm running our builds with TeamCity and a command line runner and wanting to pass in build parameters such as subversion revision, build number etc.

Is this possible?

When building ant projects I can simply refer to ${build.vcs.number.0} inside my build.xml and I'm away, however I want to do this on my command line, such as:

/opt/sod/sod.sh -Dversion="${build.vcs.number.N}" .......

Currently this just passes in the raw text, and if I use the TeamCity reference %system.build.vcs.number.0% the build no longer finds a matching runner.

Am I missing something?

Mark

4 comments

Hi Mark,

Go to "Properties and environment variables" section of the build configuration and expand section
"Predefined environment variables". I think this is what you need - you should be able to reference them like %BUILD_NUMBER%.

Hope this helps,
KIR

0

Thanks - I'll give that a bash i the morning when I get to the office. Although, as I mentioned in the original post I'd tried using the scm revision var which just blocked the build - I'll give it another look thou.

0

They don't seem to be expanding for the command line runner:

: /opt/sod/sod.sh -Dversion="%BUILD_NUMBER%" -cmd sod.build "all" -updateProject name=smx32 basePackage=smx3 baseDir=.

Is what I see executed after setting the build parameters.

0

Hi Mark,

Looks like we don't substitute variables in command line parameters of simple runner.
As a workaround, try moving -Dversion="%BUILD_NUMBER%" part inside sod.sh script.

Hope this helps,
KIR

0

Please sign in to leave a comment.