Retrieve plugin config data in the agent side
Hi,
I'm working on a plugin that implements an AdminPage to configure some connectivity details for integration with 3rd party system.
The AdminPage is using another controller that saves the connectivity details to a config XML file using ChangeListner. (like this one)
Now, when the config is in place and the administrator configured everything, I need to be able to access this information both from my build feature(BuildFeature) and my runner(RunType) in the agent in order to connect to the 3rd party system i'm integrating with.
In the agent side i'm implementing AgentBuildRunner and AgentLifeCycleAdapter.
What will be the best approach for retrieving the plugin information in the agent side(AgentBuildRunner and AgentLifeCycleAdapter)? do you have some open source references?
Thanks!
Tomer
Please sign in to leave a comment.
yea, that will defiantly help to know!
One extension that you could implement is jetbrains.buildServer.serverSide.BuildStartContextProcessor
It is called right before a build is sent to an agent. Extension receives jetbrains.buildServer.serverSide.BuildStartContext instance. This context instance allows you to add some parameters to the build (see addSharedParameter method). These parameters will be passed to the agent and will be accessible via AgentRunningBuild#getSharedConfigParameters or AgentRunningBuild#getSharedBuildParameters
Note that for historical reasons on the agent side build parameter is a system property or environment variable, hence it has prefix system. or env. Configuration parameter does not have such a prefix. So if you added system.myparam on the server, then you should use getSharedBuildParameters on the agent, if you added myparam, then getSharedConfigParameters should be used.
Hope it helps.