Access teamCity Build number in Java

Answered

I am running my automation test suite from TeamCity. I need to access the buildId property as I have a situation where I have to construct a file path using this buildId.

I tried using System.getProperty("teamcity.build.id")  but it just displays null.  How can I access the buildID of the current team city run from my java code.

1 comment

Hello,

TeamCity parameters are passed to environment or to the supported build script engines. For more details please see the related section in the documentation. 

Please try the following:

System.getenv("BUILD_NUMBER")
0

Please sign in to leave a comment.