Migration to TC how to add offset to teamcity.build.id

Answered

Hello,

We are migrating to TeamCity and we a problem with the server %teamcity.build.id% which have restarted. Like with our previous build system we use it to have a global unique id accros all builds but since it restarted with TC we will have collision and the since the counter is no more monotonic the build sorting is mess in our other tools.

I see in the database, in the table domain_sequence, that there is a record promotion_id with contain the last potentially used value.

If I change it to a bigger one TC will use it at the next restart or after a couple build when it finish to use the provisioned ones.

Is that a safe operation or do you have a better ways to add an offset to %teamcity.build.id%

Thanks in advance

 

3 comments
Comment actions Permalink

Hi,

%teamcity.build.id% is really only intended to be used internally as a unique identifier for TeamCity to differentiate between builds, so I'm not sure it is possible to manipulate this value safely.

Instead, I would suggest using the %build.number% parameter which can be tailored to meet your desired formatting and numeric starting point. For tips on formatting, please see our documentation here: https://www.jetbrains.com/help/teamcity/configuring-general-settings.html#Build+Number+Format.

0
Comment actions Permalink

Hello Eric,

Thanks for your answer.

I checked the %build.counter% and we can't use it since we need a cross project uid to identify our build.

Or maybe I don't see how to use a "root" project id in our sub project.

thanks

0
Comment actions Permalink

I see you've been working with Denis on a support ticket for this same question. Generally, it is not recommended to manually edit the database. Since you're getting some support from our developers on your support ticket, I'd say it is okay to continue on that path this time.

I had meant to use the %build.number% parameter, not %build.counter% parameter. The build number parameter is customizable, so you can add additional details to it or change the format altogether.

Another possibility could be to add a custom parameter to your root project that contains the %teamcity.build.id% parameter and add some additional identifier(s) to prevent future duplicates. For example, you could add a parameter called %teamcity.build.id.offset% and make it equal to "2021_%teamcity.build.id%". In this way, all of your %teamcity.build.id.offset% values will begin with "2021_". 

0

Please sign in to leave a comment.