extract build results for new builds daily, reporting

We are working on a set of reports and need to locate and extract the builds completed since some date (usually today).

the configuration/job, status, duration, date/time, maybe the agent the job ran on

I've found the job log, but it is in some internal format.

there could be a few to hundreds of jobs run today.

on the other major build tool we zip all the logs and status that changed today and send them to the database import processor

the project name tells us which group (of 60 worldwide) own the job, the agent tells us where the job was run, date/time when, results.

I can run a new job on TC to do the work, access the file system or use apis..  want json or xml content results.

we want to save the log text as well, so if there are research work tasks to understand issues, we can view the log directly, even if t was erased from the build system to save space

4 comments
Comment actions Permalink

using the REST api and curl, I created a small perl script to loop thru the projects, build types, builds and build statistics to get the data we need.

but it has to get all the jobs before it can filter out those that don't meet the 'today' date requirement. seems a shame to pound on the server like this.

get projects
loop thru projects
get project_contents (project->href)

get buildtypes for project (project_content->buildtypes)
loop thru build types

get the buildType
its list of builds
loop thru the builds

get build info (build->href)
get the statistics for the (buildinfo->statistics)

build id=6 name='foo' for Project='build from git' run on agent=buildserver started=20141106T090128-0600 ended=20141106T090157-0600 duration=55 seconds status=FAILURE

0
Comment actions Permalink

Hello,

Please try the following request to get the list of builds that started after the date specified:

http://teamcity:8111/httpAuth/app/rest/builds/?locator=sinceDate:20150428T140500%2B0400
0
Comment actions Permalink

cool thx.. is the +0400 on the end the timezone shift number?

still have to go thru every job to get the duration.

0
Comment actions Permalink

Yes, "+0400" is a timezone offset.
You can also specify what field you want to include in response:

http://teamcity:8111/httpAuth/app/rest/builds/?locator=sinceDate:20150428T140500%2B0400&fields=$long,build(id,number,buildType(id,name,projectName),agent(name),status,startDate,finishDate,statistics(property(name,value)))

See the related section in documentation: https://confluence.jetbrains.com/display/TCD9/REST+API#RESTAPI-Statistics

0

Please sign in to leave a comment.