Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Info

The API described below is available since TeamCity 5.1

Build Trigger Service

Build trigger is a service whose purpose is to trigger builds (add builds to the queue). Build trigger must extend

Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerService
version5.1.1
abstract class. Build trigger service is uniquely identified by trigger name (see getTriggerName method). There is no need to register BuildTriggerService, instead plugin should provide a class extending the
Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerService
version5.1.1
defined as a Spring bean.

Build Trigger Settings

Build trigger settings is an object containing build trigger parameters specified by a user via the web UI. Build trigger settings are represented by

Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerDescriptor
version5.1.1
class. The settings are contained within a map of string parameters. More than one instance of
Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerDescriptor
version5.1.1
corresponding to the same trigger service can be added to the build configuration or a template. Instances of the
Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerDescriptor
version5.1.1
with the same trigger name and parameters are considered equal. With help of
Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggerService
methodisMultipleTriggersPerBuildTypeAllowed()
version5.1.1
trigger service can allow or disallow multiple trigger settings per build configuration.

Each trigger service can provide an URL to a jsp or custom controller which will show the trigger web UI. The approach is similar to the one used for VCS roots and build runners.

Triggering Policy

Build trigger service must return a policy (

Tc javadoc
classjetbrains.buildServer.buildTriggers.BuildTriggeringPolicy
version5.1.1
) which will be used to add builds to the queue. Currently only one policy is available:
Tc javadoc
classjetbrains.buildServer.buildTriggers.PolledBuildTrigger
version5.1.1
. More policies can be added in the future.

Trigger returning

Tc javadoc
classjetbrains.buildServer.buildTriggers.PolledBuildTrigger
version5.1.1
policy will be polled by the server with regular intervals. Trigger will receive
Tc javadoc
classjetbrains.buildServer.buildTriggers.PolledTriggerContext
version5.1.1
object which contains all information necessary to make a decision whether a build must be triggered or not. Trigger can use
Tc javadoc
classjetbrains.buildServer.serverSide.SBuildType
methodaddToQueue(java.lang.String)
version5.1.1
method to add builds to the queue. Note that
Tc javadoc
classjetbrains.buildServer.buildTriggers.PolledTriggerContext
version5.1.1
also provides access to the custom data storage. This storage can be used for build trigger state associated with a build configuration and trigger settings. Custom storage will be automatically persisted and restored upon server restart.