Custom Build Trigger

compared with
Current by Maria Khalusova
on Oct 06, 2011 14:14.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (4)

View Page History
h2. 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:class=jetbrains.buildServer.buildTriggers.BuildTriggerService|version=5.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:class=jetbrains.buildServer.buildTriggers.BuildTriggerService|version=5.1.1} defined as a Spring bean.

h2. 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:class=jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor|version=5.1.1} class. The settings are contained within a map of string parameters. More than one instance of {tc-javadoc:class=jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor|version=5.1.1} corresponding to the same trigger service can be added to the build configuration or a template. Instances of the {tc-javadoc:class=jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor|version=5.1.1} with the same trigger name and parameters are considered equal. With help of {tc-javadoc:jetbrains.buildServer.buildTriggers.BuildTriggerService#isMultipleTriggersPerBuildTypeAllowed()} {tc-javadoc:class=jetbrains.buildServer.buildTriggers.BuildTriggerService|method=isMultipleTriggersPerBuildTypeAllowed()|version=5.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.
h2. Triggering Policy

Build trigger service must return a policy ({tc-javadoc:class=jetbrains.buildServer.buildTriggers.BuildTriggeringPolicy|version=5.1.1}) which will be used to add builds to the queue. Currently only one policy is available: {tc-javadoc:class=jetbrains.buildServer.buildTriggers.PolledBuildTrigger|version=5.1.1}. More policies can be added in the future.

Trigger returning {tc-javadoc:class=jetbrains.buildServer.buildTriggers.PolledBuildTrigger|version=5.1.1} policy will be polled by the server with regular intervals. Trigger will receive {tc-javadoc:class=jetbrains.buildServer.buildTriggers.PolledTriggerContext|version=5.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:jetbrains.buildServer.serverSide.SBuildType#addToQueue(java.lang.String)} {tc-javadoc:class=jetbrains.buildServer.serverSide.SBuildType|method=addToQueue(java.lang.String)|version=5.1.1} method to add builds to the queue. Note that {tc-javadoc:class=jetbrains.buildServer.buildTriggers.PolledTriggerContext|version=5.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.