1
votes

I have configured a SVN file in TeamCity server. And also set the property "Trigger a build on each check-in". So the file Build is triggered after every check-in is happened. Now I want to access the build information of configured SVN files while build is triggering.

I have a web space in Mediawiki. Mediawiki has some api to edit/create pages. I wish to call Mediawiki api with SVN build information from TeamCity server itself.

Is there any way to do this ?

what is the HSQL2 database in Teamcity server. Can we use this DB to access build information ?

1

1 Answers

0
votes

You can use the TeamCity REST API to get the build changes, example:

curl /httpAuth/app/rest/changes?build=id:%teamcity.build.id%

As a command line build step will yield something like:

<changes count="3">
   <change href="/httpAuth/app/rest/changes/id:217404" id="217404" version="b6b97a0d7789d97df6df908ab582ebb723235f43" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217404&personal=false"/>
   <change href="/httpAuth/app/rest/changes/id:217403" id="217403" version="064ecef5552ec2fb7875d7c26fe54cdf94b67bec" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217403&personal=false"/>
   <change href="/httpAuth/app/rest/changes/id:217402" id="217402" version="9bc3a34c952059bbfc7bebeb79ba5a3c894ef555" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217402&personal=false"/>
</changes>

Then you can loop through the change and hit its href which will yield like:

<change date="20130918T133404-0600" username="welsh" href="/httpAuth/app/rest/changes/id:217397" id="217397" version="51e925e354a83deccde881b30a76974b2ff745f4" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217397&personal=false">
  <comment>
My comments are here
  </comment>
  <files>
    <file before-revision="90acd4da1972814094c22e3020c5073521a7b640@141323126c0" after-revision="51e925e354a83deccde881b30a76974b2ff745f4@1413290abe0" file="grails-app/views/layouts/global.gsp" relative-file="grails-app/views/layouts/global.gsp"/>
  </files>
  <user href="/httpAuth/app/rest/users/id:1" id="1" name="Welsh" username="welsh"/>
</change>

Then you can create something to take this information to push it to your media wiki.