How to get currently running build for given project?

Problem: on every green build I'm sending a new build to TestFlight (an iOS app) for internal testing. For each build I want to write release notes which would be collection of git commits that triggered this build.

I'm successfully wrote a script that grabs most recent build and checks want changes triggered that build. But this most recent build is last one that was successful. I'm unable to get currently running build.

My approaches so far:
1) Use /builds endpoint. http://localhost:8111/guestAuth/app/rest/builds?locator=running:false but I cannot guess the locator param for given app. ?locator=running:false,,buildTypeId:XXX does not work.
2) Use /guestAuth/app/rest/buildTypes/id:XXX and later fetch build via guestAuth/app/rest/buildTypes/id:XXX/builds/ but those does not contain currently running builds.

Any help?

2 comments
Comment actions Permalink

Hi Wiktor,

Won't it be an option to add your script as a last build step of your build configuration? In this case you can grab build's info using http://localhost:8111/guestAuth/app/rest/builds/id:%teamcity.build.id%.

The following locator: http://localhost:8111/guestAuth/app/rest/builds?locator=running:true,buildType:Test_1, where Test_1 is system.teamcity.buildType.id should return the list of running builds of Test_1 build configuration.

0
Comment actions Permalink

I totally forgot that I can use env variable to get current build number. That was so easy. Thanks

0

Please sign in to leave a comment.