Class GerritTrigger
java.lang.Object
hudson.triggers.Trigger<Job>
com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger
- All Implemented Interfaces:
ExtensionPoint,Describable<Trigger<?>>
Triggers a build based on Gerrit events.
- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.triggers.Trigger
Trigger.CronNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionGerritTrigger(List<GerritProject> gerritProjects) Default DataBound Constructor.GerritTrigger(List<GerritProject> gerritProjects, SkipVote skipVote, Integer gerritBuildStartedVerifiedValue, Integer gerritBuildStartedCodeReviewValue, Integer gerritBuildSuccessfulVerifiedValue, Integer gerritBuildSuccessfulCodeReviewValue, Integer gerritBuildFailedVerifiedValue, Integer gerritBuildFailedCodeReviewValue, Integer gerritBuildUnstableVerifiedValue, Integer gerritBuildUnstableCodeReviewValue, Integer gerritBuildNotBuiltVerifiedValue, Integer gerritBuildNotBuiltCodeReviewValue, boolean silentMode, boolean silentStartMode, boolean escapeQuotes, boolean noNameAndEmailParameters, boolean readableMessage, String dependencyJobsNames, String buildStartMessage, String buildSuccessfulMessage, String buildUnstableMessage, String buildFailureMessage, String buildNotBuiltMessage, String buildUnsuccessfulFilepath, String customUrl, String serverName, String gerritSlaveId, List<PluginGerritEvent> triggerOnEvents, boolean dynamicTriggerConfiguration, String triggerConfigURL, String notificationLevel) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanabortBecauseOfTopic(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event, BuildCancellationPolicy policy, com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent runningChange) Checks that execution must be aborted because of topic.voidCancels the timerTask, if it exists.protected ParametersActioncreateParameters(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Deprecated.Fills the verdict category drop-down list for the comment-added events.booleangerritSlavesToWaitFor(String gerritServerName) Convenience method to get the list of GerritSlave to which replication should be done before letting the build execute.The message to show users when a build is aborted, if custom messages are enabled.The message to show users when a build finishes, if custom messages are enabled.The message to show users when all builds are not built, if custom messages are enabled.intgetBuildScheduleDelay method will return configured buildScheduledelay value.The message to show users when a build starts, if custom messages are enabled.The message to show users when a build succeeds, if custom messages are enabled.The message to show users when a build is unstable, if custom messages are enabled.The path to a file that contains the unsuccessful Gerrit comment message.What mode the change subject parameterGerritTriggerParameters.GERRIT_CHANGE_SUBJECTshould be used when adding it.What mode the comment text parameterGerritTriggerParameters.GERRIT_EVENT_COMMENT_TEXTshould be used when adding it.What mode the commit message parameterGerritTriggerParameters.GERRIT_CHANGE_COMMIT_MESSAGEshould be used when adding it.URL to send in comment to Gerrit.The list of dependency jobs, ie jobs on which this job depends.The list of dynamically configured triggering rules.Job specific Gerrit code review vote when a build is aborted, null means that the global value should be used.Job specific Gerrit verified vote when a build is aborted, null means that the global value should be used.Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.Job specific Gerrit code review vote when a build is started, null means that the global value should be used.Job specific Gerrit verified vote when a build is started, null means that the global value should be used.Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.The list of GerritProject triggering rules.The selected slave associated to this job, if enabled in server configs.The parameter mode for the compound "name and email" parameters.Whom to notify.Returns name of server.The skip vote selection.Returns the assigned TopicAssociation object.static GerritTriggergetTrigger(Job project) Finds the GerritTrigger in a project.The URL where the trigger configuration should be fetched from.Getter for the triggerOnEvents list.inthashCode()booleanThe build cancellation policy regarding building current patch sets only.booleanIf trigger configuration should be fetched from a URL or not.booleanDeprecated.booleanif escapeQuotes is on or off.booleanConvenience method for finding it out if file triggering is enabled in the Gerrit version.booleanisInteresting(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Should we trigger on this event?booleanDeprecated.replaced withgetNameAndEmailParameterMode()booleanisOnlyAbortRunningBuild(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Checks based on the current event if the job should just be aborted, or even a new job should be triggered.booleanDeprecated.replaced withgetCommitMessageParameterMode()booleanIf silent mode is on or off.booleanIf silent start mode is on or off.booleanConvenience method for finding it out if triggering on draft published is enabled in the Gerrit version.voidnotifyBuildEnded(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Used to inform the server that the builds for a job have ended.Converts old trigger configs when only patchset created was available as event and when jobs were not associated to Gerrit servers.voidretriggerAllBuilds(TriggerContext context) Retriggers all builds in the given context.voidretriggerThisBuild(TriggerContext context) Re-triggers the build inTriggerContext.getThisBuild()for the context's event.protected voidschedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Deprecated.protected voidschedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Deprecated.voidsetBuildAbortedMessage(String buildAbortedMessage) Message to write to Gerrit when a build is aborted.voidsetBuildCancellationPolicy(BuildCancellationPolicy buildCancellationPolicy) The build cancellation policy regarding building current patch sets only.voidsetBuildFailureMessage(String buildFailureMessage) Message to write to Gerrit when a build fails.voidsetBuildNotBuiltMessage(String buildNotBuiltMessage) Message to write to Gerrit when all builds are not built.voidsetBuildStartMessage(String buildStartMessage) Message to write to Gerrit when a build begins.voidsetBuildSuccessfulMessage(String buildSuccessfulMessage) Message to write to Gerrit when a build succeeds.voidsetBuildUnstableMessage(String buildUnstableMessage) Message to write to Gerrit when a build is unstable.voidsetBuildUnsuccessfulFilepath(String buildUnsuccessfulFilepath) Sets the path to a file that contains the unsuccessful Gerrit comment message.voidsetChangeSubjectParameterMode(GerritTriggerParameters.ParameterMode changeSubjectParameterMode) What mode the change subject parameterGerritTriggerParameters.GERRIT_CHANGE_SUBJECTshould be used when adding it.voidsetCommentTextParameterMode(GerritTriggerParameters.ParameterMode commentTextParameterMode) What mode the comment text parameterGerritTriggerParameters.GERRIT_EVENT_COMMENT_TEXTshould be used when adding it.voidsetCommitMessageParameterMode(GerritTriggerParameters.ParameterMode commitMessageParameterMode) What mode the commit message parameterGerritTriggerParameters.GERRIT_CHANGE_COMMIT_MESSAGEshould be used when adding it.voidsetCustomUrl(String customUrl) Custom URL to send to Gerrit instead of build URL.voidsetDependencyJobsNames(String dependencyJobsNames) The list of jobs on which this job depends.voidsetDynamicTriggerConfiguration(boolean dynamicTriggerConfiguration) Set if dynamic trigger configuration should be enabled or not.voidsetEnableTopicAssociation(boolean enable) Deprecated.voidsetEscapeQuotes(boolean escapeQuotes) Sets escapeQuotes to on or off.voidsetGerritBuildAbortedCodeReviewValue(Integer gerritBuildAbortedCodeReviewValue) Job specific Gerrit code review vote when a build is aborted, providing null means that the global value should be used.voidsetGerritBuildAbortedVerifiedValue(Integer gerritBuildAbortedVerifiedValue) Job specific Gerrit verified vote when a build is aborted, providing null means that the global value should be used.voidsetGerritBuildFailedCodeReviewValue(Integer gerritBuildFailedCodeReviewValue) Job specific Gerrit code review vote when a build is failed, providing null means that the global value should be used.voidsetGerritBuildFailedVerifiedValue(Integer gerritBuildFailedVerifiedValue) Job specific Gerrit verified vote when a build is failed, providing null means that the global value should be used.voidsetGerritBuildNotBuiltCodeReviewValue(Integer gerritBuildNotBuiltCodeReviewValue) Job specific Gerrit code review vote when a build is not built, providing null means that the global value should be used.voidsetGerritBuildNotBuiltVerifiedValue(Integer gerritBuildNotBuiltVerifiedValue) Job specific Gerrit verified vote when a build is not built, providing null means that the global value should be used.voidsetGerritBuildStartedCodeReviewValue(Integer gerritBuildStartedCodeReviewValue) Job specific Gerrit code review vote when a build is started, providing null means that the global value should be used.voidsetGerritBuildStartedVerifiedValue(Integer gerritBuildStartedVerifiedValue) Job specific Gerrit verified vote when a build is started, providing null means that the global value should be used.voidsetGerritBuildSuccessfulCodeReviewValue(Integer gerritBuildSuccessfulCodeReviewValue) Job specific Gerrit code review vote when a build is successful, providing null means that the global value should be used.voidsetGerritBuildSuccessfulVerifiedValue(Integer gerritBuildSuccessfulVerifiedValue) Job specific Gerrit verified vote when a build is successful, providing null means that the global value should be used.voidsetGerritBuildUnstableCodeReviewValue(Integer gerritBuildUnstableCodeReviewValue) Job specific Gerrit code review vote when a build is unstable, providing null means that the global value should be used.voidsetGerritBuildUnstableVerifiedValue(Integer gerritBuildUnstableVerifiedValue) Job specific Gerrit verified vote when a build is unstable, providing null means that the global value should be used.voidsetGerritProjects(List<GerritProject> gerritProjects) The list of GerritProject triggering rules.voidsetGerritSlaveId(String gerritSlaveId) The selected slave associated to this job, if enabled in server configs.voidsetNameAndEmailParameterMode(GerritTriggerParameters.ParameterMode nameAndEmailParameterMode) The parameter mode for the compound "name and email" parameters.voidsetNoNameAndEmailParameters(boolean noNameAndEmailParameters) Deprecated.voidsetNotificationLevel(String notificationLevel) Whom to notify.voidsetReadableMessage(boolean readableMessage) Deprecated.voidsetServerName(String name) Set the selected server.voidsetSilentMode(boolean silentMode) Sets silent mode to on or off.voidsetSilentStartMode(boolean silentStartMode) Sets silent start mode to on or off.voidsetSkipVote(SkipVote skipVote) The skip vote selection.voidsetTopicAssociation(TopicAssociation topicAssociation) DataBoundSetter for TopicAssociation.voidsetTriggerConfigURL(String triggerConfigURL) Set the URL where the trigger configuration should be fetched from.voidsetTriggerOnEvents(List<PluginGerritEvent> triggerOnEvents) The list of event types to trigger on.voidvoidstop()voidThis method is called by the timer thread at regular intervals.voidWait for the project list to be ready.Methods inherited from class hudson.triggers.Trigger
all, checkTriggers, for_, getProjectAction, getSpec, run, toString
-
Constructor Details
-
GerritTrigger
Default DataBound Constructor.- Parameters:
gerritProjects- the set of triggering rules.
-
GerritTrigger
@Deprecated public GerritTrigger(List<GerritProject> gerritProjects, SkipVote skipVote, Integer gerritBuildStartedVerifiedValue, Integer gerritBuildStartedCodeReviewValue, Integer gerritBuildSuccessfulVerifiedValue, Integer gerritBuildSuccessfulCodeReviewValue, Integer gerritBuildFailedVerifiedValue, Integer gerritBuildFailedCodeReviewValue, Integer gerritBuildUnstableVerifiedValue, Integer gerritBuildUnstableCodeReviewValue, Integer gerritBuildNotBuiltVerifiedValue, Integer gerritBuildNotBuiltCodeReviewValue, boolean silentMode, boolean silentStartMode, boolean escapeQuotes, boolean noNameAndEmailParameters, boolean readableMessage, String dependencyJobsNames, String buildStartMessage, String buildSuccessfulMessage, String buildUnstableMessage, String buildFailureMessage, String buildNotBuiltMessage, String buildUnsuccessfulFilepath, String customUrl, String serverName, String gerritSlaveId, List<PluginGerritEvent> triggerOnEvents, boolean dynamicTriggerConfiguration, String triggerConfigURL, String notificationLevel) Deprecated.Old DataBound Constructor. Replaced withGerritTrigger(List)andDataBoundSetters.- Parameters:
gerritProjects- the set of triggering rules.skipVote- what votes if any should be skipped in the final verified/code review calculation.gerritBuildStartedVerifiedValue- Job specific Gerrit verified vote when a build is started, null means that the global value should be used.gerritBuildStartedCodeReviewValue- Job specific Gerrit code review vote when a build is started, null means that the global value should be used.gerritBuildSuccessfulVerifiedValue- Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.gerritBuildSuccessfulCodeReviewValue- Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.gerritBuildFailedVerifiedValue- Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.gerritBuildFailedCodeReviewValue- Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.gerritBuildUnstableVerifiedValue- Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.gerritBuildUnstableCodeReviewValue- Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.gerritBuildNotBuiltVerifiedValue- Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.gerritBuildNotBuiltCodeReviewValue- Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.silentMode- Silent Mode on or off.silentStartMode- Silent Start Mode on or off.escapeQuotes- EscapeQuotes on or off.noNameAndEmailParameters- Whether to create parameters containing name and emailreadableMessage- Human readable message or not.dependencyJobsNames- The list of jobs on which this job dependsbuildStartMessage- Message to write to Gerrit when a build beginsbuildSuccessfulMessage- Message to write to Gerrit when a build succeedsbuildUnstableMessage- Message to write to Gerrit when a build is unstablebuildFailureMessage- Message to write to Gerrit when a build failsbuildNotBuiltMessage- Message to write to Gerrit when all builds are not builtbuildUnsuccessfulFilepath- Filename to retrieve Gerrit comment message from, in the case of an unsuccessful build.customUrl- Custom URL to send to Gerrit instead of build URLserverName- The selected servergerritSlaveId- The selected slave associated to this job, if enabled in server configstriggerOnEvents- The list of event types to trigger on.dynamicTriggerConfiguration- Dynamic trigger configuration on or offtriggerConfigURL- Where to fetch the configuration file fromnotificationLevel- Whom to notify.
-
-
Method Details
-
getNameAndEmailParameterMode
The parameter mode for the compound "name and email" parameters. ReplacesisNoNameAndEmailParameters(). -
setNameAndEmailParameterMode
@DataBoundSetter public void setNameAndEmailParameterMode(@NonNull GerritTriggerParameters.ParameterMode nameAndEmailParameterMode) The parameter mode for the compound "name and email" parameters. ReplacesisNoNameAndEmailParameters().- Parameters:
nameAndEmailParameterMode- the mode- See Also:
-
getCommitMessageParameterMode
What mode the commit message parameterGerritTriggerParameters.GERRIT_CHANGE_COMMIT_MESSAGEshould be used when adding it.- Returns:
- the mode
-
setCommitMessageParameterMode
@DataBoundSetter public void setCommitMessageParameterMode(@NonNull GerritTriggerParameters.ParameterMode commitMessageParameterMode) What mode the commit message parameterGerritTriggerParameters.GERRIT_CHANGE_COMMIT_MESSAGEshould be used when adding it.- Parameters:
commitMessageParameterMode- the mode
-
getChangeSubjectParameterMode
What mode the change subject parameterGerritTriggerParameters.GERRIT_CHANGE_SUBJECTshould be used when adding it.- Returns:
- the mode
-
setChangeSubjectParameterMode
@DataBoundSetter public void setChangeSubjectParameterMode(@NonNull GerritTriggerParameters.ParameterMode changeSubjectParameterMode) What mode the change subject parameterGerritTriggerParameters.GERRIT_CHANGE_SUBJECTshould be used when adding it.- Parameters:
changeSubjectParameterMode- the mode
-
getCommentTextParameterMode
What mode the comment text parameterGerritTriggerParameters.GERRIT_EVENT_COMMENT_TEXTshould be used when adding it.- Returns:
- the mode
-
setCommentTextParameterMode
@DataBoundSetter public void setCommentTextParameterMode(@NonNull GerritTriggerParameters.ParameterMode commentTextParameterMode) What mode the comment text parameterGerritTriggerParameters.GERRIT_EVENT_COMMENT_TEXTshould be used when adding it.- Parameters:
commentTextParameterMode- the mode
-
setSkipVote
The skip vote selection. "Skipping" the vote means that if more than one build of this job is triggered by a Gerrit event the outcome of this build won't be counted when the final vote is sent to Gerrit.- Parameters:
skipVote- what votes if any should be skipped in the final
-
getServerName
Returns name of server.- Returns:
- the server name
-
setServerName
Set the selected server.- Parameters:
name- the name of the newly selected server.
-
getGerritSlaveId
The selected slave associated to this job, if enabled in server configs.- Returns:
- the id of the gerrit slave
- See Also:
-
setGerritSlaveId
The selected slave associated to this job, if enabled in server configs.- Parameters:
gerritSlaveId- the id of the gerrit slave- See Also:
-
getTrigger
Finds the GerritTrigger in a project.- Parameters:
project- the project.- Returns:
- the trigger if there is one, null otherwise.
-
cancelTimer
public void cancelTimer()Cancels the timerTask, if it exists. -
start
-
stop
public void stop() -
schedule
@Deprecated protected void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Deprecated.Schedules a build with parameters from the event. WithTrigger.jobas the project to build.- Parameters:
cause- the cause of the build.event- the event.
-
schedule
@Deprecated protected void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Deprecated.Schedules a build with parameters from the event.- Parameters:
cause- the cause of the build.event- the event.project- the project to build.
-
createParameters
@Deprecated protected ParametersAction createParameters(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Deprecated.Creates a ParameterAction and fills it with the project's default parameters + the Standard Gerrit parameters.- Parameters:
event- the event.project- the project.- Returns:
- the ParameterAction.
-
doFillVerdictCategoryItems
Fills the verdict category drop-down list for the comment-added events.- Returns:
- a ListBoxModel for the drop-down list.
-
notifyBuildEnded
public void notifyBuildEnded(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Used to inform the server that the builds for a job have ended. This allows us to clean up our list of what jobs we're running.- Parameters:
event- the event.
-
getBuildScheduleDelay
public int getBuildScheduleDelay()getBuildScheduleDelay method will return configured buildScheduledelay value. If the value is missing or invalid it the method will return default schedule delay orGerritDefaultValues.DEFAULT_BUILD_SCHEDULE_DELAY.- Returns:
- buildScheduleDelay.
-
retriggerThisBuild
Re-triggers the build inTriggerContext.getThisBuild()for the context's event. Will not do anyisInteresting(GerritTriggeredEvent)checks. If more than one build was triggered by the event the results from those builds will be counted again, but they won't be re-triggered. If any builds for the event are still running, this new scheduled build will replace its predesessor. If the project is currently building the event, no scheduling will be done.- Parameters:
context- the previous context.
-
retriggerAllBuilds
Retriggers all builds in the given context. The builds will only be triggered if no builds for the event are building.- Parameters:
context- the context to rebuild.- See Also:
-
hashCode
public int hashCode() -
equals
-
isOnlyAbortRunningBuild
public boolean isOnlyAbortRunningBuild(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Checks based on the current event if the job should just be aborted, or even a new job should be triggered.- Parameters:
event- The ChangeBasedEvent.- Returns:
- true if the job should only be aborted without triggering a new one, otherwise false.
-
isInteresting
public boolean isInteresting(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Should we trigger on this event?- Parameters:
event- the event- Returns:
- true if we should.
-
getGerritProjects
The list of GerritProject triggering rules.- Returns:
- the rule-set.
-
getDynamicGerritProjects
The list of dynamically configured triggering rules.- Returns:
- the rule-set.
-
setGerritProjects
The list of GerritProject triggering rules.- Parameters:
gerritProjects- the rule-set
-
getGerritBuildFailedCodeReviewValue
Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildFailedCodeReviewValue
@DataBoundSetter public void setGerritBuildFailedCodeReviewValue(Integer gerritBuildFailedCodeReviewValue) Job specific Gerrit code review vote when a build is failed, providing null means that the global value should be used.- Parameters:
gerritBuildFailedCodeReviewValue- the vote value.
-
getGerritBuildFailedVerifiedValue
Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildFailedVerifiedValue
@DataBoundSetter public void setGerritBuildFailedVerifiedValue(Integer gerritBuildFailedVerifiedValue) Job specific Gerrit verified vote when a build is failed, providing null means that the global value should be used.- Parameters:
gerritBuildFailedVerifiedValue- the vote value.
-
getGerritBuildStartedCodeReviewValue
Job specific Gerrit code review vote when a build is started, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildStartedCodeReviewValue
@DataBoundSetter public void setGerritBuildStartedCodeReviewValue(Integer gerritBuildStartedCodeReviewValue) Job specific Gerrit code review vote when a build is started, providing null means that the global value should be used.- Parameters:
gerritBuildStartedCodeReviewValue- the vote value.
-
getGerritBuildStartedVerifiedValue
Job specific Gerrit verified vote when a build is started, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildStartedVerifiedValue
@DataBoundSetter public void setGerritBuildStartedVerifiedValue(Integer gerritBuildStartedVerifiedValue) Job specific Gerrit verified vote when a build is started, providing null means that the global value should be used.- Parameters:
gerritBuildStartedVerifiedValue- the vote value.
-
getGerritBuildSuccessfulCodeReviewValue
Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildSuccessfulCodeReviewValue
@DataBoundSetter public void setGerritBuildSuccessfulCodeReviewValue(Integer gerritBuildSuccessfulCodeReviewValue) Job specific Gerrit code review vote when a build is successful, providing null means that the global value should be used.- Parameters:
gerritBuildSuccessfulCodeReviewValue- the vote value.
-
getGerritBuildSuccessfulVerifiedValue
Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildSuccessfulVerifiedValue
@DataBoundSetter public void setGerritBuildSuccessfulVerifiedValue(Integer gerritBuildSuccessfulVerifiedValue) Job specific Gerrit verified vote when a build is successful, providing null means that the global value should be used.- Parameters:
gerritBuildSuccessfulVerifiedValue- the vote value.
-
getGerritBuildUnstableCodeReviewValue
Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildUnstableCodeReviewValue
@DataBoundSetter public void setGerritBuildUnstableCodeReviewValue(Integer gerritBuildUnstableCodeReviewValue) Job specific Gerrit code review vote when a build is unstable, providing null means that the global value should be used.- Parameters:
gerritBuildUnstableCodeReviewValue- the vote value.
-
getGerritBuildUnstableVerifiedValue
Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildUnstableVerifiedValue
@DataBoundSetter public void setGerritBuildUnstableVerifiedValue(Integer gerritBuildUnstableVerifiedValue) Job specific Gerrit verified vote when a build is unstable, providing null means that the global value should be used.- Parameters:
gerritBuildUnstableVerifiedValue- the vote value.
-
getGerritBuildNotBuiltCodeReviewValue
Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildNotBuiltCodeReviewValue
@DataBoundSetter public void setGerritBuildNotBuiltCodeReviewValue(Integer gerritBuildNotBuiltCodeReviewValue) Job specific Gerrit code review vote when a build is not built, providing null means that the global value should be used.- Parameters:
gerritBuildNotBuiltCodeReviewValue- the vote value.
-
getGerritBuildNotBuiltVerifiedValue
Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildNotBuiltVerifiedValue
@DataBoundSetter public void setGerritBuildNotBuiltVerifiedValue(Integer gerritBuildNotBuiltVerifiedValue) Job specific Gerrit verified vote when a build is not built, providing null means that the global value should be used.- Parameters:
gerritBuildNotBuiltVerifiedValue- the vote value.
-
getGerritBuildAbortedCodeReviewValue
Job specific Gerrit code review vote when a build is aborted, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildAbortedCodeReviewValue
@DataBoundSetter public void setGerritBuildAbortedCodeReviewValue(Integer gerritBuildAbortedCodeReviewValue) Job specific Gerrit code review vote when a build is aborted, providing null means that the global value should be used.- Parameters:
gerritBuildAbortedCodeReviewValue- the vote value.
-
getGerritBuildAbortedVerifiedValue
Job specific Gerrit verified vote when a build is aborted, null means that the global value should be used.- Returns:
- the vote value.
-
setGerritBuildAbortedVerifiedValue
@DataBoundSetter public void setGerritBuildAbortedVerifiedValue(Integer gerritBuildAbortedVerifiedValue) Job specific Gerrit verified vote when a build is aborted, providing null means that the global value should be used.- Parameters:
gerritBuildAbortedVerifiedValue- the vote value.
-
setBuildUnsuccessfulFilepath
Sets the path to a file that contains the unsuccessful Gerrit comment message. Filename to retrieve Gerrit comment message from, in the case of an unsuccessful build.- Parameters:
buildUnsuccessfulFilepath- The unsuccessful message comment file path
-
getTriggerOnEvents
Getter for the triggerOnEvents list.- Returns:
- the list.
-
setTriggerOnEvents
The list of event types to trigger on.- Parameters:
triggerOnEvents- the list
-
isDynamicTriggerConfiguration
public boolean isDynamicTriggerConfiguration()If trigger configuration should be fetched from a URL or not.- Returns:
- true if trigger configuration should be fetched from a URL.
-
setDynamicTriggerConfiguration
@DataBoundSetter public void setDynamicTriggerConfiguration(boolean dynamicTriggerConfiguration) Set if dynamic trigger configuration should be enabled or not.- Parameters:
dynamicTriggerConfiguration- true if dynamic trigger configuration should be enabled.
-
getTriggerConfigURL
The URL where the trigger configuration should be fetched from.- Returns:
- the URL, or null if this feature is not used.
-
setTriggerConfigURL
Set the URL where the trigger configuration should be fetched from.- Parameters:
triggerConfigURL- the URL where the trigger configuration should be fetched from.- See Also:
-
dynamicTriggerConfigurationdynamicGerritProjects
-
getDependencyJobsNames
The list of dependency jobs, ie jobs on which this job depends.- Returns:
- the string of jobs, or null if this feature is not used.
-
setDependencyJobsNames
The list of jobs on which this job depends.- Parameters:
dependencyJobsNames- the string containing a comma-separated list of job names.
-
isSilentMode
public boolean isSilentMode()If silent mode is on or off. When silent mode is on there will be no communication back to Gerrit, i.e. no build started/failed/successful approve messages etc. Default is false.- Returns:
- true if silent mode is on.
-
isSilentStartMode
public boolean isSilentStartMode()If silent start mode is on or off. When silent start mode is on there will be no 'build started' message back to Gerrit. Default is false.- Returns:
- true if silent start mode is on.
-
getNotificationLevel
Whom to notify.- Returns:
- the notification level value
-
isEscapeQuotes
public boolean isEscapeQuotes()if escapeQuotes is on or off. When escapeQuotes is on this plugin will escape quotes in Gerrit event parameter string Default is true- Returns:
- true if escapeQuotes is on.
-
setEscapeQuotes
@DataBoundSetter public void setEscapeQuotes(boolean escapeQuotes) Sets escapeQuotes to on or off. When escapeQuotes is on plugin will escape quotes in Gerrit event parameter string. Default is false.- Parameters:
escapeQuotes- is true if escapeQuotes should be on.
-
isNoNameAndEmailParameters
Deprecated.replaced withgetNameAndEmailParameterMode()If noNameAndEmailParameters is on or off. When this is set on this plugin will not create parameters which combine a name with an email (this applies change owner, restorer, etc). These parameters cause problems with some configurations.- Returns:
- true if noNameAndEmailParameters is on.
-
setNoNameAndEmailParameters
Deprecated.Sets noNameAndEmailParameters to on or off. When this is set on this plugin will not create parameters which combine a name with an email (this applies change owner, restorer, etc). These parameters cause problems with some configurations.- Parameters:
noNameAndEmailParameters- is true if problematic parameters should be omitted.
-
isReadableMessage
Deprecated.replaced withgetCommitMessageParameterMode()If readableMessage is on or off. When this is set on this plugin will create parameters for multiline text, e.g. commit message, as human readable message. When this is set off, it will be encoded.- Returns:
- true if readableMessage is on.
-
setReadableMessage
Deprecated.Sets readableMessage to on or off. When this is set on this plugin will create parameters for multiline text, e.g. commit message, as human readable message. when this is set off, it will be encoded.- Parameters:
readableMessage- is true if human readable message is set.
-
getBuildStartMessage
The message to show users when a build starts, if custom messages are enabled.- Returns:
- The build start message
-
setBuildStartMessage
Message to write to Gerrit when a build begins.- Parameters:
buildStartMessage- The build start message
-
getBuildCancellationPolicy
- Returns:
- the buildCurrentPatchesOnly
-
isBuildCurrentPatchesOnly
public boolean isBuildCurrentPatchesOnly()The build cancellation policy regarding building current patch sets only.- Returns:
- the policy
-
setBuildCancellationPolicy
@DataBoundSetter public void setBuildCancellationPolicy(BuildCancellationPolicy buildCancellationPolicy) The build cancellation policy regarding building current patch sets only.- Parameters:
buildCancellationPolicy- the policy
-
getBuildSuccessfulMessage
The message to show users when a build succeeds, if custom messages are enabled.- Returns:
- The build successful message
-
setBuildSuccessfulMessage
Message to write to Gerrit when a build succeeds.- Parameters:
buildSuccessfulMessage- The build successful message
-
getBuildUnstableMessage
The message to show users when a build is unstable, if custom messages are enabled.- Returns:
- The build unstable message
-
setBuildUnstableMessage
Message to write to Gerrit when a build is unstable.- Parameters:
buildUnstableMessage- The build unstable message
-
getBuildFailureMessage
The message to show users when a build finishes, if custom messages are enabled.- Returns:
- The build failure message
-
setBuildFailureMessage
Message to write to Gerrit when a build fails.- Parameters:
buildFailureMessage- The build failure message
-
getBuildNotBuiltMessage
The message to show users when all builds are not built, if custom messages are enabled.- Returns:
- The build not built message
-
setBuildNotBuiltMessage
Message to write to Gerrit when all builds are not built.- Parameters:
buildNotBuiltMessage- The build not built message
-
getBuildAbortedMessage
The message to show users when a build is aborted, if custom messages are enabled.- Returns:
- The build aborted message
-
setBuildAbortedMessage
Message to write to Gerrit when a build is aborted.- Parameters:
buildAbortedMessage- The build aborted message
-
getBuildUnsuccessfulFilepath
The path to a file that contains the unsuccessful Gerrit comment message.- Returns:
- The unsuccessful message comment file path
-
setSilentMode
@DataBoundSetter public void setSilentMode(boolean silentMode) Sets silent mode to on or off. When silent mode is on there will be no communication back to Gerrit, i.e. no build started/failed/successful approve messages etc. Default is false.- Parameters:
silentMode- true if silent mode should be on.
-
setEnableTopicAssociation
Deprecated.Enable or disable Topic Association option. Replaced bysetTopicAssociation(TopicAssociation)()- Parameters:
enable- true or false.
-
isEnableTopicAssociation
Deprecated.Check if topic association is enabled.- Returns:
- true if so.
-
setTopicAssociation
DataBoundSetter for TopicAssociation. Used for jelly file.- Parameters:
topicAssociation- the TopicAssociation object.
-
getTopicAssociation
Returns the assigned TopicAssociation object. Used for jelly file.- Returns:
- TopicAssociation object
-
setSilentStartMode
@DataBoundSetter public void setSilentStartMode(boolean silentStartMode) Sets silent start mode to on or off. When silent start mode is on there will be no 'silent start' message back to Gerrit. Default is false.- Parameters:
silentStartMode- true if silent start mode should be on.
-
setNotificationLevel
Whom to notify.- Parameters:
notificationLevel- the notification level.
-
getCustomUrl
URL to send in comment to Gerrit.- Returns:
- custom URL to post back to Gerrit
-
setCustomUrl
Custom URL to send to Gerrit instead of build URL.- Parameters:
customUrl- URL to set
-
isFileTriggerEnabled
public boolean isFileTriggerEnabled()Convenience method for finding it out if file triggering is enabled in the Gerrit version.- Returns:
- true if file triggering is enabled in the Gerrit version.
-
updateTriggerConfigURL
public void updateTriggerConfigURL()This method is called by the timer thread at regular intervals. It fetches the URL, determines if the result is different than from the last fetch, and if so, replaces the current URL trigger configuration with the fetched one. -
isTriggerOnDraftPublishedEnabled
public boolean isTriggerOnDraftPublishedEnabled()Convenience method for finding it out if triggering on draft published is enabled in the Gerrit version.- Returns:
- true if triggering on draft published is enabled in the Gerrit version.
-
gerritSlavesToWaitFor
Convenience method to get the list of GerritSlave to which replication should be done before letting the build execute.- Parameters:
gerritServerName- The Gerrit server name- Returns:
- list of GerritSlave (can be empty but never null)
-
getProjectActions
- Overrides:
getProjectActionsin classTrigger<Job>
-
getSkipVote
The skip vote selection. "Skipping" the vote means that if more than one build of this job is triggered by a Gerrit event the outcome of this build won't be counted when the final vote is sent to Gerrit.- Returns:
- data structure for what build results to skip.
-
waitForProjectListToBeReady
Wait for the project list to be ready. This is here so that the EventListener can call it before it asks if an event is interesting (viaisInteresting(GerritTriggeredEvent)).- Throws:
InterruptedException- if the thread was interrupted while waiting.
-
readResolve
Converts old trigger configs when only patchset created was available as event and when jobs were not associated to Gerrit servers.- Overrides:
readResolvein classTrigger<Job>- Returns:
- the resolved instance.
- Throws:
ObjectStreamException- if something beneath goes wrong.
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Trigger<?>>- Overrides:
getDescriptorin classTrigger<Job>
-
abortBecauseOfTopic
protected boolean abortBecauseOfTopic(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event, BuildCancellationPolicy policy, com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent runningChange) Checks that execution must be aborted because of topic.- Parameters:
event- the event.policy- the cancellation policy.runningChange- the ongoing change.- Returns:
- true if so.
-
EventListener.createParameters(GerritTriggeredEvent, Job)