Using build number variable at runtime

Hello,

Among other problems I am toiling with in attempting to make our build work with TeamCity is the fact that I seem to be unable to use the build number variable to create a directory at run time. I wrote an init ant target that includes creating a directory that includes the current build number.

This is what I have tried so far (with all non-pertinent code removed):
]]>
<property name="BUILD_LOGS" value="$/build-$/logs"/>

<mkdir dir="$"/>

I have also tried the following variable names for the build number:
build.number
myenv.BUILD_NUMBER
myenv.system.build.number

The result is that the directory created is the literal string rather than the build number value.

Can anyone suggest a way of doing this?

Thanks,
-Dave

2 comments
Comment actions Permalink

Hi Dave

I'm currently using TeamCity to do something similar. I use the ${build.number} property passed into ant by TC to make up other properties. Here's an example taken from one of my build.xml files...

Deriving Build Information Build Version : ${build.version} Build Number : ${build.number} Build Date : ${build.date} Build Tag : ${build.tag} ]]>

When I run the build locally, through IDEA my build number is set to 'DEV'. When it is run via TC it picks up whatever is passed in (ant properties can only be set once).

To summarise, TC definitely passes in a property named 'build.number' so I'd guess it's something in your config thats incorrect.

HTH

Paul

0
Comment actions Permalink

Paul,

Thanks for your reply. My problem turned out to be a simple typo.

-Dave

0

Please sign in to leave a comment.