Class VcsTriggerContext
- java.lang.Object
-
- jetbrains.buildServer.buildTriggers.vcs.VcsTriggerContext
-
- All Implemented Interfaces:
PolledTriggerContext
public class VcsTriggerContext extends Object implements PolledTriggerContext
-
-
Constructor Summary
Constructors Constructor Description VcsTriggerContext(PolledTriggerContext delegate, jetbrains.buildServer.buildTriggers.vcs.RepositoryStateUpdateListener repoStateUpdateListener, int defaultQuietPeriod, VcsTriggeringContext triggeringContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BuildCustomizercreateBuildCustomizer(SUser user)Creates aBuildCustomizerinstance that should be used to trigger a build: the returned customizer is preconfigured with custom parameters specified in the trigger settings.SBuildTypegetBuildType()Build configuration for which the trigger is calledlonggetCurrentTime()since processing trigger may take some time, trigger implementations shouldn't useSystem.currentTimeMillis()for time Otherwise unnecessary triggering may occur if trigger depends on time.CustomDataStoragegetCustomDataStorage()Returns custom data storage associated with build configuration and trigger descriptor.LoggergetLogger()Returns logger which can be used to log trigger related activity.LoggergetLogger(Branch branch)DategetPreviousCallTime()Time of the previous call of the trigger, can be null if this is the first time the trigger is calledSet<VcsRootInstance>getRootsInChain()BuildTriggerDescriptorgetTriggerDescriptor()Build trigger settingsTriggerRulesgetTriggerRules()VcsTriggerDescriptorgetVcsTriggerDescriptor()booleanisRepositoryStateUpdated()List<SBuildType>watchedBuildTypes()
-
-
-
Constructor Detail
-
VcsTriggerContext
public VcsTriggerContext(@NotNull PolledTriggerContext delegate, @NotNull jetbrains.buildServer.buildTriggers.vcs.RepositoryStateUpdateListener repoStateUpdateListener, int defaultQuietPeriod, @NotNull VcsTriggeringContext triggeringContext)
-
-
Method Detail
-
getBuildType
@NotNull public SBuildType getBuildType()
Description copied from interface:PolledTriggerContextBuild configuration for which the trigger is called- Specified by:
getBuildTypein interfacePolledTriggerContext- Returns:
- see above
-
getCurrentTime
public long getCurrentTime()
Description copied from interface:PolledTriggerContextsince processing trigger may take some time, trigger implementations shouldn't useSystem.currentTimeMillis()for time Otherwise unnecessary triggering may occur if trigger depends on time. Instead ofSystem.currentTimeMillis()use this method- Specified by:
getCurrentTimein interfacePolledTriggerContext- Returns:
- current time in milliseconds for this trigger processing (like
System.currentTimeMillis())
-
getTriggerDescriptor
@NotNull public BuildTriggerDescriptor getTriggerDescriptor()
Description copied from interface:PolledTriggerContextBuild trigger settings- Specified by:
getTriggerDescriptorin interfacePolledTriggerContext- Returns:
- see above
-
getPreviousCallTime
@Nullable public Date getPreviousCallTime()
Description copied from interface:PolledTriggerContextTime of the previous call of the trigger, can be null if this is the first time the trigger is called- Specified by:
getPreviousCallTimein interfacePolledTriggerContext- Returns:
- see above
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage()
Description copied from interface:PolledTriggerContextReturns custom data storage associated with build configuration and trigger descriptor. This storage can be used for remembering the per build type state of the build trigger.- Specified by:
getCustomDataStoragein interfacePolledTriggerContext- Returns:
- custom data storage for the pair: build configuration and trigger descriptor
-
createBuildCustomizer
@NotNull public BuildCustomizer createBuildCustomizer(SUser user)
Description copied from interface:PolledTriggerContextCreates aBuildCustomizerinstance that should be used to trigger a build: the returned customizer is preconfigured with custom parameters specified in the trigger settings.- Specified by:
createBuildCustomizerin interfacePolledTriggerContext- Parameters:
user- optional user, will beBuildCustomizerFactory.createBuildCustomizer(SBuildType, SUser)- See Also:
BuildTriggerService.supportsBuildCustomization()
-
getLogger
@NotNull public Logger getLogger()
Description copied from interface:PolledTriggerContextReturns logger which can be used to log trigger related activity. Note the provided logger will automatically prepend all messages with id of the build configuration where the trigger belongs.- Specified by:
getLoggerin interfacePolledTriggerContext- Returns:
- see above
-
getVcsTriggerDescriptor
@NotNull public VcsTriggerDescriptor getVcsTriggerDescriptor()
-
isRepositoryStateUpdated
public boolean isRepositoryStateUpdated()
-
watchedBuildTypes
@NotNull public List<SBuildType> watchedBuildTypes()
- Returns:
- buildTypes watched by the trigger. Result includes the buildType where the trigger is defined. If the 'trigger on changes from dependencies' option is enabled, result also includes all dependencies.
-
getTriggerRules
@NotNull public TriggerRules getTriggerRules()
-
getRootsInChain
@NotNull public Set<VcsRootInstance> getRootsInChain()
-
-