Domanda

I have a build configuration in TeamCity, which creates a zipped 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 is working fine and TeamCity shows the correct buildnumber for the build, but the "artifact paths" setup is not using the updated parameter, so the zipfile is named with the original %build.number%. (**/*.*=>Test.%build.number%.zip)

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

To me it looks like the parameters used by the artifacts setup are prepopulated before the buildsteps are run. Is this the case? And if so, is it possible for me to fix this?

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top