Labelling snapshot dependency commits on release promotion

Completed

Hi,

I want to be able to iterate through build parameters of all snapshot dependencies (dep.<btID>.<property name>) used in a build in a powershell script. Is there a way do discover the list of <btID>s? I do not want to hard code the IDs as they may change with time.

Background

We are using SemVer release versioning for a product. When we promote an RC to released we label its commit and our tools then automatically bump the version on next build. That is fine. However the product uses ~20 components which are snapshot dependencies are are only released as part of the product. So we want to also label the source repos for each dependency at the same time ... but they have independent versioning so each will have a different label e.g: v2.3.4

So my question is about how to get info on each dependence such as repo name, commit ID, SemVer, so the script can do the labelling .... but without hardcoding the depency build IDs.

Thanks

2 comments
Comment actions Permalink

Hello Robert!

There are two options as of now to retrieve the dependencies of the current build:

1) you could use teamcity.build.id property to resolve internal ID of the build, then make a REST API call to the following endpoint:

/app/rest/builds/id:521

The dependencies will be listed under snapshot-dependencies and artifact-dependencies sections of the response. Please see this article for the details on REST API usage (https://www.jetbrains.com/help/teamcity/rest-api.html).

2) If you access system.teamcity.configuration.properties.file during the build, it will point to the current properties file (see the contents example):

You can read the contents of file, iterate through the lines once to get the unique btIDs under dep.* and then use them as required. 

--------------------------------------------

I`ve made a feature request about providing the list of dependencies as a separate parameter (so to avoid the above overhead): https://youtrack.jetbrains.com/issue/TW-66061 - please feel free to keep track of it.

0
Comment actions Permalink

Hi Fedor,

Thank you. I'm always impressed with JetBrains support!

You have answered my question.

Rob

0

Please sign in to leave a comment.