How to access the all the Project Names for a build chain

Answered

HI Team,

I am trying to access project names for a build chain. Is this possible with Rest API with single call ?

I have a Build Chain like A->B->C->D->E where A is the main build and B, C, D, E are child builds. Is it possible to get the project names of each build (A,B,C,D,E) with single call? 

I am able to get the project name details per each build using the call 

"http://teamcity:8111/app/rest/builds/id:BuildID"  but using this i need to iterate all the builds to get the Project Name

Could you please advice if there is any option to achieve this using one call ?

 

Thanks

Chaitanya

 

0
3 comments

Hello Chaitanya,

I have just tried the following endpoint:

/app/rest/buildTypes/id:<A_Configuration_ID>

Among other data, it brought in two sections (snapshot-dependencies and artifact-dependencies). Both of them do contain snapshot or artifact dependency, correspondingly; for each dependency source-buildType node is included which contains projectId value.

You may limit the request to bring just the required information; please use the below endpoint to get just the main build ID/name and ID/name/project ID/project name for each dependency:

/app/rest/buildTypes?locator=id:<A_Configuration_ID>&fields=buildType(id,name,snapshot-dependencies(snapshot-dependency(source-buildType(id,name,projectId,projectName))),artifact-dependencies(artifact-dependency(source-buildType(id,name,projectId,projectName))))

I hope this helps.

0

Thanks a lot Fedor this really helps, You saved my day :)

Just wondering if there is any similar API for getting all the artifacts for a particular build chain in one go using the BuildID. Again i don't want to iterate all the builds in the build chain to get the artifacts that i am looking for.

Thanks 

Chaitanya 

 

0

Hello Chaitanya,

One sample request which should list the artifacts from the dependencies could look like this:

/app/rest/builds?locator=id:<main_build_ID>&fields=build(id,buildTypeId,artifact-dependencies(build(id,buildTypeId,artifacts(file))))

Otherwise, I would suggest to consider usage of composite builds (https://www.jetbrains.com/help/teamcity/composite-build-configuration.html); these are specific type of builds, they do not have own build steps, do summarize tests results and allow to access the artifacts from their dependencies as if all of them were the artifacts of the composite build (that is, serving as a sort of build chain result dashboard).

0

Please sign in to leave a comment.