Custom Build Runner, can I modify the System Properties?

I have some UI for a custom build runner and I would like to pass this to a python script by using System Properties. This is because the System Properties are already written out to a nice easily parseable file.
I also want users to be able to override some properties by using the Custom Build UI, which can set System Properties as well.

However I can't figure out where to set the system properties from- I have been trying from the Agent-side code but perhaps this is wrong? If necessary I could do it from the server-side?

For now I can just use Environment variables - as I can set these up using the SimpleProgramCommandLine / CommandLineBuilderService.

But I would prefer to use system properties if possible.


Many thanks,

Mark

4 comments

markltbaker wrote:

For now I can just use Environment variables - as I can set these up using the SimpleProgramCommandLine / CommandLineBuilderService.

Hmmm.

Actually I spoke too soon - I can build a Map<String,String> of new environment variables and pas it to SimpleProgramCommandLine() but it doesn't then get used when the command is run ?:|
At least not according to my test python script that just dumps out everything in os.environ.

So that's a bit poor!  I guess I will have to use command line arguments after all!

0

May be able to use a ParametersPreprocessor on the server to do what I want, which would be ok - this is discussed here: javascript:;

I'm also reading things from Agent Custom Properties, which is working great. If I set this up in the Properties settings for a build, then TeamCity will know that there is an implicit Agent Requirement for a certain property to be defined, which is useful.
Is there a way to register this in a plugin, so I can get the same Agent Requirement?

Alternatively, can I extend Agent Requirements to do this myself? It seem reasonable that a Custom Runner might have certain agent requirements based on settings chosen (e.g. requirement for a certain version of an SDK installed).

0

If you want to add system properties to a build so that you'll be able to use them on the agent, you should create extension implementing ParametersPreprocessor interface. In version 5.1 it is not that easy to add additional parameters on the agent. In 6.0 we are going to improve it a lot.

0

Hi Pavel,

I'm happy with my work-around for now so I will revisit this after 6.0 is released. Thanks for the update!

0

Please sign in to leave a comment.