Passing build counter from one project to another.

Hi everyone, I am making an effort to customize the output of a project build.

We have a "deploy" project that is time-scheduled, (not build-triggered) and has some artifact dependencies on another build. I am attempting to take the build counter of the build that the "deploy" project is dependent on, and place this build counter somewhere on the main project screen near where it says "success" or "failure" so we can easily tell which "build" project the "deploy" project is based off of in term of artifacts. I have been looking over the docs and have a few leads, but I have some questions about those leads.

1.) I read about build script integration (##teamcity...). However, either I am missing something or the docs aren't very clear about what build script you can use this functionality in. I tried it in ant to no avail.  I set up a simple build step on my project that looked like this:




<project name = "HelloWorld" basedir = "." default = "main">
    <target name="main">
        <manifest file = "joel.txt"/>
    </target>
##teamcity[message 'helloWorld!']
</project>


The build errors out because of that ##teamcity line.

2.) Environment variable and build number format - It would probably be sufficient to just display the build counter of the "deploy" project as the same build as the artifacts that it is deploying from(the "build" project). For that, I would need to somehow access the build counter from the "build" project and bring it into the "deploy" project. Is there a way to do that using environment variables? Doing more research, I thought it might be possible to pass it using the teacmcity-info.xml file. But speaking of....

3.) Where is the teamcity.xml file? The docs say "It is possible to generate a teamcity-info.xml file...." Meaning it does not generate unless you somehow tell TC to?

I looked over this thread http://devnet.jetbrains.com/thread/433320 but I don't think its what I am looking for.

Those are my main questions. I believe if I can get some help with these, I may be able to come up with the answer. Any help is appreciated. I have looked through the docs and Google. Thanks.

-Joel

5 comments
Comment actions Permalink
hi  simply append to the deploy build number (General Settings section, normally {0}) the %dep.btXX.build.number% variable where XX is the bt ID of the dependant job (build?). This way the build number of the deployment job will tell you which dependency it had.  the build number format will look like {0}/%dep.btXX.build.number% If you want to generate a build number in ANT and send to to Teamcity, then this is the syntax, after you populate some.variable or use a teamcity varibale value, as mentioned above:    <target name="StepName" description="Generating build number for teamcity">        <echo message="##teamcity[buildNumber '${some.variable}']"/>    </target> cheers ziv shapira
0
Comment actions Permalink

Thanks Ziv, Really helpful information. It looks like I'll be able to work with that. Do you have any idea about the teamcity-info.xml file as well?

0
Comment actions Permalink

normally the files are under /root/.BuildServer/

  if the answer helped, please mark it as correct for the benefit of others.

Thanks

0
Comment actions Permalink

>the files are under /root/.BuildServer/
I don't see any subfolder in windows /.BuildServer/, and 'root' is ambiguous?
thank you!

0
Comment actions Permalink

Shoot, This question wasn't marked as a question, so I can't mark it as answered. I am so sorry! First time using the forum, my bad.

0

Please sign in to leave a comment.