|
Documentation Index
|
Server-Side ExtensionsServer-side plugin organization and deploymentTo write a server-side plugin, you'll need to include jar libraries from <TeamCity web application>/WEB-INF/lib directory to your classpath. Default TeamCity web application is "<TeamCity home>/webapps/ROOT. Server-side plugins are delivered as a set of jar files, one of which contains the plugin descriptor file. The plugin code should be active - plugin components should register themselves in various TeamCity managers and components. Corresponding TeamCity managers should be passed via constructor (they will be passed by Spring framework via autowiring, see Descriptor section below) If you are extending the Web UI, please also refer to Web UI Extensions. DescriptorThe plugin descriptor file is named build-server-plugin-<unique_plugin_name>.xml and contains component definitions according to Spring configuration file syntax. Base configuration of the server can be found in /WEB-INF/lib/server.jar!/META-INF/buildServerSpring.xml and /WEB-INF/buildServerSpringWeb.xml files. Example descriptor: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="constructor"> <bean id="emailNotificator" class="jetbrains.buildServer.notification.email.EMailNotificator"/> <bean id="emailNotificatorSettingsController" class="jetbrains.buildServer.controllers.email.EMailNotificatorSettingsController"/> </beans> DeploymentPut the jar files with server side plugins into the /WEB-INF/lib/ directory on the server. Writing Server-side ExtensionsBuild server listenersShould extend jetbrains.buildServer.serverSide.BuildServerListener interface and register itself using public class MyListener extends BuildServerAdapter { public MyListener(SBuildServer server) { server.addListener(this); } // Your overridden methods go here } Server-side extension pointsTeamCity server has a number of extension points, where a plugin can provide some additional functionality. An extension point is defined in terms of interface, which extends jetbrains.buildServer.serverSide.ServerExtension. There are several such interfaces/extension points. To register an extension, a plugin should invoke method jetbrains.buildServer.serverSide.ServerExtensionHolder#registerExtension(extension_class, pluginCode, extensionObject). Here is a list of some extension points:
Some core componentsjetbrains.buildServer.serverSide.SBuildServerThis is one of the core components of the TeamCity server-side support.
jetbrains.buildServer.serverSide.ProjectManagerThis component provides access to TeamCity project structure, allows to list all available projects and build configurations, jetbrains.buildServer.serverSide.RunningBuildsManagerManager for currently running builds. See also jetbrains.buildServer.serverSide.SRunningBuild jetbrains.buildServer.serverSide.BuildHistoryProvides access to build history (you can also access historical builds for a build configuration using methods in jetbrains.buildServer.serverSide.SBuildType) jetbrains.buildServer.users.UserModelManager of various user-oriented operations in TeamCity, allows to list/find user accounts, create user accounts etc. jetbrains.buildServer.vcs.VcsManagerA basic starting point for various VCS-related operations, including, but not limited to:
|