TeamCity: parameter in the artifact settings, cannot be changed from the service message

I have an assembly configuration in TeamCity that creates an archived artifact. The artifact contains the %build.number% parameter in the zipfile name.

I want to change the build number from a custom tool through a service message.

This works great, and TeamCity shows the correct build number for the build, but the "artifact path" setting does not use the updated option, so the zipfile has the name with the original% build.number%. (**/*.*=>Test.%build.number%.zip)

I also tested this with a custom parameter. I create the parameter %test% and set the initial value to "1" and then change it in the service message ( ##teamcity[setParameter name='test' value='2'] ). If I pass %test% to another build step, passed 2. But the artifact is still called "Test.1.zip".

It seems to me that the parameters used by the installation of artifacts are pre-populated before running buildstep. This is true? And if so, is it possible to fix this?

Edit: I found the correct parameter that could use:% teamcity.build.id% :)

+4
source share
1 answer

You can fix this by using the environment variable as the assembly name. The original %build.number% will be passed to your build tool. Change it and save, i.e. BUILD_NUMBER , then use %env.BUILD_NUMBER% in TeamCity.

+1
source

Source: https://habr.com/ru/post/1436764/


All Articles