Populating Build Parameter (selection in custom run) from script

Hi

Does anyone know if it is possible to populating a Build Parameter from script, for example. It seems that parameter values can only be hardcoded in TeamCity UI.
The requirement: selection of the parameter's values in a custom run, should be pulled from a server, to reflect current state of the options.

Thanks
Ziv Shapira

3 comments
Comment actions Permalink

Are you using (or could you use) MSBuild? Are these properties static, but vary by environment?

If so then you can keep your properties in a separate file and then import it using http://msdn.microsoft.com/en-us/library/92x05xfs.aspx

You would then have a properties file per environment with the necessary values. The hard coded TeamCity property will determine which file to use.

Your import statement would look like

<Import Project="{some path}\Config\$(Environment).properties"/>

and your properties files would look like

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <YourProperty>YourValue</YourProperty>
    </PropertyGroup>
</Project>

If you need dynamic properties to be read at the time of the build and therefore cannot hold them in a file then maybe create a build step to run a script which reads these values and writes the properties file (or even the build file) for subsequent steps to use.

0
Comment actions Permalink

Hi Andy

Thanks, I am running on Linux and not Windows.
I agree that I can make a step that creates a file with the options, but then how does someone select from them, if I cannot populate a build parameter...

0
Comment actions Permalink

Have you seen the teamcity.default.properties file? It's not exactly populating it from a script, but it does allow you to pass build parameters in to the build process. Might not fit your needs exactly though.

0

Please sign in to leave a comment.