How to put conditional value into a Build Parameter

I want to set the value of an Environment parameter (e.g. %env.Configuration% ) based on the teamcity.build.triggeredBy variable.

When the triggeredBy = "Schedule" I want the Configuration parameter to be set to "Debug"

I know how to use one variable/parameter in the value of another parameter.

Is there a conditional clause like

%teamcity.build.triggeredBy% == 'Schedule' :? 'Debug' : 'Release'

that I can put into the value?

0
3 comments

Hi Brian,

It is not possible to add condition into build parameter. Please feel free to create feature request in our tracker.
Also you can create a custom plugin, for example see Web Parameters plugin.

Interested users also could see the related forum thread.

0

Is there any update on this feature request since 2014? thanks!

0
Avatar
Fedor Rumyantsev

Hello,

On newer versions one can use service messages to report a new value for the build parameter:

echo ##teamcity[setParameter name='myParameter' value='myNewValue']
You could emit these messages as a first step of your build and use the updated value in the later steps. Please mind that parameter has to be defined (with any value or as an empty parameter) before the build, so your parameter references could work. 

Please let me know if this helps.
0

Please sign in to leave a comment.