How to have agent plugin with configuration UI on server?

As the subject says. I want to extend the admin settings to have an editable string, which the agent plugin can retrieve on startup (and ideally be notified when it changes).

At the moment I've tried to split the functionality into an agent and server plugin, then bundle them into one zip file - is that even possible?  It doesn't seem to be working.
What's the recommended way to do this?

Thanks

1 comment
Comment actions Permalink

Hello,

Agent and Server plugins uses slightly different API subsets. It is pussible to put classes into one .jar file.
Still you need to have 2 copies of those .jar files in server plugin package.
There is a risk you use server api's from agent-side plugin part. That is why I'd recommend you to split it into 3 .jars: common, server and agent.

To add custom UI into server admin pages, please take a look at
jetbrains.buildServer.web.openapi.PlaceId
This is the list of UI extension places.
To add a tab into admin page you need to implement ADMIN_SERVER_CONFIGURATION_TAB page extension.
Take a look on NuGet plugin example of it:
https://github.com/JetBrains/teamcity-nuget-support/blob/v0.7/nuget-server/src/jetbrains/buildServer/nuget/server/settings/tab/ServerSettingsTab.java


Do you need the propery to be on agent all the time?
You may transfer the opeperty on build srart. Is the enough?
If so, please take a look at
jetbrains.buildServer.serverSide.BuildStartContextProcessor
server extension point.
The method to let a plugin change starting build parameters.
This is a best place to add some configuration parameter for the build.


On the build agent-side you need to register to
jetbrains.buildServer.agent.AgentLifeCycleListener event listener (via EventDispatcher<AgentLifeCycleListener> spring bean)
and handle buildStarted event.

If you need a property on agent start? You may consider to patch agent-side plugin to include a resource with property value.
Every time you change agent-side plugin, server initiates agent upgrade process (with agent process restart)
You may use jetbrains.buildServer.web.openapi.PluginDescriptor#getPluginRoot on the server side to get server plugin folder location.


I know I wrote too much text and some of it could be complicated. Please do not hesitate to ask me for details.
BTW. Could you please elaborate what you like to implement in your plugin.

0

Please sign in to leave a comment.