Accessing runner configuration through BuildAgentConfiguration

Is there any way to get the Runner configuration parameters from the BuildAgentConfiguration?

My problem raises with the canRun method in the AgentBuildRunnerInfo, and the mix of operating system and a few configuration parameters for the agent runner would determine the canRun result.

Right now I can access the configuration parameters in the BuildProcess because the createBuildProcess method have a BuildRunnerContext that I can use to get the parameters through getRunnerParameters, but I can't see a simple way to get the runner parameters from the custom AgentBuildRunnerInfo... yes, my process is a Java inline process and it doesn't run an external command line process as most of the samples around in internet...

My rudimentary code is in it is in early stages by now... so feel free to make any comments :)

Comment actions Permalink


#canRun method is executed on build agent start, there is no build context. This information is used by TeamCity server to know if agent can (in principle) execute given build runner. You may refactor canRun method in two steps:
- check agent-specific prerequisites in canRun method
- on RunType implementation override #getRunnerSpecificRequirements and add collection of requirements that are based on build runner parameters

Comment actions Permalink

Thank you Eugene,

That basically means that deciding in which agent the build should run is a two step process...

1. The agent has some basic requirements to run on (Operating System, framework versions, environment configuration)
2. The server can take a final desicion based in the specific requirements from the configuration parameters (I can see that things like the compilation of a specific project based in the installed version of the .NET framework or Java configuration can be done in this step depending on the choosen parameters).

As you point out, the best option for me is overriding the specified method in my RunType, and inject the required property as part of the build...

Again, Thanks Eugene


Please sign in to leave a comment.