com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger
Class GerritTrigger

java.lang.Object
  extended by hudson.triggers.Trigger<hudson.model.AbstractProject>
      extended by com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger
All Implemented Interfaces:
com.sonymobile.tools.gerrit.gerritevents.GerritEventListener, hudson.ExtensionPoint, hudson.model.Describable<hudson.triggers.Trigger<?>>

public class GerritTrigger
extends hudson.triggers.Trigger<hudson.model.AbstractProject>
implements com.sonymobile.tools.gerrit.gerritevents.GerritEventListener

Triggers a build based on Gerrit events.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Nested Class Summary
static class GerritTrigger.DescriptorImpl
          The Descriptor for the Trigger.
 class GerritTrigger.RunningJobs
          Class for maintaining and synchronizing the runningJobs info.
 
Nested classes/interfaces inherited from class hudson.triggers.Trigger
hudson.triggers.Trigger.Cron
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.triggers.Trigger
job, spec, tabs, timer
 
Constructor Summary
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 delayedApproval, 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, boolean allowTriggeringUnreviewedPatches, String triggerConfigURL)
          Default DataBound Constructor.
 
Method Summary
 void cancelTimer()
          Cancels the timerTask, if it exists.
protected  hudson.model.ParametersAction createParameters(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, hudson.model.AbstractProject project)
          Creates a ParameterAction and fills it with the project's default parameters + the Standard Gerrit parameters.
 hudson.util.ListBoxModel doFillVerdictCategoryItems()
          Fills the verdict category drop-down list for the comment-added events.
 boolean equals(Object obj)
           
 void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.events.CommentAdded event)
          Called when a CommentAdded event arrives.
 void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
           
 void gerritEvent(ManualPatchsetCreated event)
          Called when a ManualPatchsetCreated event arrives.
 List<GerritSlave> gerritSlavesToWaitFor(String gerritServerName)
          Convenience method to get the list of GerritSlave to which replication should be done before letting the build execute.
 String getBuildFailureMessage()
          The message to show users when a build finishes, if custom messages are enabled.
 String getBuildNotBuiltMessage()
          The message to show users when all builds are not built, if custom messages are enabled.
 int getBuildScheduleDelay()
          getBuildScheduleDelay method will return configured buildScheduledelay value.
 String getBuildStartMessage()
          The message to show users when a build starts, if custom messages are enabled.
 String getBuildSuccessfulMessage()
          The message to show users when a build succeeds, if custom messages are enabled.
 String getBuildUnstableMessage()
          The message to show users when a build is unstable, if custom messages are enabled.
 String getBuildUnsuccessfulFilepath()
          The path to a file that contains the unsuccessful Gerrit comment message.
 String getCustomUrl()
          URL to send in comment to Gerrit.
 String getDependencyJobsNames()
          The list of dependency jobs, ie jobs on which this job depends.
 List<GerritProject> getDynamicGerritProjects()
          The list of dynamically configured triggering rules.
 Integer getGerritBuildFailedCodeReviewValue()
          Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.
 Integer getGerritBuildFailedVerifiedValue()
          Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.
 Integer getGerritBuildNotBuiltCodeReviewValue()
          Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.
 Integer getGerritBuildNotBuiltVerifiedValue()
          Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.
 Integer getGerritBuildStartedCodeReviewValue()
          Job specific Gerrit code review vote when a build is started, null means that the global value should be used.
 Integer getGerritBuildStartedVerifiedValue()
          Job specific Gerrit verified vote when a build is started, null means that the global value should be used.
 Integer getGerritBuildSuccessfulCodeReviewValue()
          Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.
 Integer getGerritBuildSuccessfulVerifiedValue()
          Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.
 Integer getGerritBuildUnstableCodeReviewValue()
          Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.
 Integer getGerritBuildUnstableVerifiedValue()
          Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.
 List<GerritProject> getGerritProjects()
          The list of GerritProject triggering rules.
 String getGerritSlaveId()
          Returns id of the gerrit slave.
 List<hudson.model.Action> getProjectActions()
           
 String getServerName()
          Returns name of server.
 SkipVote getSkipVote()
          The skip vote selection.
static GerritTrigger getTrigger(hudson.model.AbstractProject project)
          Finds the GerritTrigger in a project.
 String getTriggerConfigURL()
          The URL where the trigger configuration should be fetched from.
 List<PluginGerritEvent> getTriggerOnEvents()
          Getter for the triggerOnEvents list.
 int hashCode()
           
 boolean isAllowTriggeringUnreviewedPatches()
          Is checking and triggering missed patches allowed when connection is created.
 boolean isDelayedApproval()
          If delayed approval is on or off.
 boolean isDynamicTriggerConfiguration()
          If trigger configuration should be fetched from a URL or not.
 boolean isEscapeQuotes()
          if escapeQuotes is on or off.
 boolean isFileTriggerEnabled()
          Convenience method for finding it out if file triggering is enabled in the Gerrit version.
 boolean isNoNameAndEmailParameters()
          If noNameAndEmailParameters is on or off.
 boolean isReadableMessage()
          If readableMessage is on or off.
 boolean isSilentMode()
          If silent mode is on or off.
 boolean isTriggerOnDraftPublishedEnabled()
          Convenience method for finding it out if triggering on draft published is enabled in the Gerrit version.
 void notifyBuildEnded(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
          Used to inform the server that the builds for a job have ended.
 Object readResolve()
          Converts old trigger configs when only patchset created was available as event and when jobs were not associated to Gerrit servers.
 void retriggerAllBuilds(TriggerContext context)
          Retriggers all builds in the given context.
 void retriggerThisBuild(TriggerContext context)
          Re-triggers the build in TriggerContext.getThisBuild() for the context's event.
protected  void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
          Schedules a build with parameters from the event.
protected  void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, hudson.model.AbstractProject project)
          Schedules a build with parameters from the event.
 void setAllowTriggeringUnreviewedPatches(boolean allowTriggeringUnreviewedPatches)
          Set if triggering missing patches configuration should be enabled or not.
 void setBuildUnsuccessfulFilepath(String path)
          Sets the path to a file that contains the unsuccessful Gerrit comment message.
 void setCustomUrl(String customUrl)
          Set custom URL to post back to Gerrit.
 void setDelayedApproval(boolean delayedApproval)
          Sets delayed approval to on or off.
 void setDependencyJobsNames(String dependencyJobsNames)
          Set the list of dependency jobs.
 void setDynamicTriggerConfiguration(boolean dynamicTriggerConfiguration)
          Set if dynamic trigger configuration should be enabled or not.
 void setEscapeQuotes(boolean escapeQuotes)
          Sets escapeQuotes to on or off.
 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.
 void setGerritBuildFailedVerifiedValue(Integer gerritBuildFailedVerifiedValue)
          Job specific Gerrit verified vote when a build is failed, providing null means that the global value should be used.
 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.
 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.
 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.
 void setGerritBuildStartedVerifiedValue(Integer gerritBuildStartedVerifiedValue)
          Job specific Gerrit verified vote when a build is started, providing null means that the global value should be used.
 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.
 void setGerritBuildSuccessfulVerifiedValue(Integer gerritBuildSuccessfulVerifiedValue)
          Job specific Gerrit verified vote when a build is successful, providing null means that the global value should be used.
 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.
 void setGerritBuildUnstableVerifiedValue(Integer gerritBuildUnstableVerifiedValue)
          Job specific Gerrit verified vote when a build is unstable, providing null means that the global value should be used.
 void setGerritProjects(List<GerritProject> gerritProjects)
          The list of GerritProject triggering rules.
 void setNoNameAndEmailParameters(boolean noNameAndEmailParameters)
          Sets noNameAndEmailParameters to on or off.
 void setReadableMessage(boolean readableMessage)
          Sets readableMessage to on or off.
 void setServerName(String name)
          Set the selected server.
 void setSilentMode(boolean silentMode)
          Sets silent mode to on or off.
 void setTriggerConfigURL(String triggerConfigURL)
          Set the URL where the trigger configuration should be fetched from.
 void start(hudson.model.AbstractProject project, boolean newInstance)
           
 void stop()
           
 void updateTriggerConfigURL()
          This method is called by the timer thread at regular intervals.
 
Methods inherited from class hudson.triggers.Trigger
all, checkTriggers, for_, getDescriptor, getProjectAction, getSpec, init, run
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GerritTrigger

@DataBoundConstructor
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 delayedApproval,
                                          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,
                                          boolean allowTriggeringUnreviewedPatches,
                                          String triggerConfigURL)
Default DataBound Constructor.

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.
delayedApproval - Delayed Approval on or off.
escapeQuotes - EscapeQuotes on or off.
noNameAndEmailParameters - Whether to create parameters containing name and email
readableMessage - Human readable message or not.
dependencyJobsNames - The list of jobs on which this job depends
buildStartMessage - Message to write to Gerrit when a build begins
buildSuccessfulMessage - Message to write to Gerrit when a build succeeds
buildUnstableMessage - Message to write to Gerrit when a build is unstable
buildFailureMessage - Message to write to Gerrit when a build fails
buildNotBuiltMessage - Message to write to Gerrit when all builds are not built
buildUnsuccessfulFilepath - Filename to retrieve Gerrit comment message from, in the case of an unsuccessful build.
customUrl - Custom URL to sen to Gerrit instead of build URL
serverName - The selected server
gerritSlaveId - The selected slave associated to this job, if enabled in server configs
triggerOnEvents - The list of event types to trigger on.
dynamicTriggerConfiguration - Dynamic trigger configuration on or off
allowTriggeringUnreviewedPatches - Is automatic patch checking allowed when connection is established
triggerConfigURL - Where to fetch the configuration file from
Method Detail

readResolve

public Object readResolve()
                   throws ObjectStreamException
Converts old trigger configs when only patchset created was available as event and when jobs were not associated to Gerrit servers.

Overrides:
readResolve in class hudson.triggers.Trigger<hudson.model.AbstractProject>
Returns:
the resolved instance.
Throws:
ObjectStreamException - if something beneath goes wrong.

getServerName

public String getServerName()
Returns name of server.

Returns:
the server name

setServerName

public void setServerName(String name)
Set the selected server.

Parameters:
name - the name of the newly selected server.

getGerritSlaveId

public String getGerritSlaveId()
Returns id of the gerrit slave.

Returns:
the id of the gerrit slave

getTrigger

public static GerritTrigger getTrigger(hudson.model.AbstractProject project)
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

public void start(hudson.model.AbstractProject project,
                  boolean newInstance)
Overrides:
start in class hudson.triggers.Trigger<hudson.model.AbstractProject>

stop

public void stop()
Overrides:
stop in class hudson.triggers.Trigger<hudson.model.AbstractProject>

gerritEvent

public void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Specified by:
gerritEvent in interface com.sonymobile.tools.gerrit.gerritevents.GerritEventListener

gerritEvent

public void gerritEvent(ManualPatchsetCreated event)
Called when a ManualPatchsetCreated event arrives.

Parameters:
event - the event

schedule

protected void schedule(GerritCause cause,
                        com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
Schedules a build with parameters from the event. With myProject as the project to build.

Parameters:
cause - the cause of the build.
event - the event.

schedule

protected void schedule(GerritCause cause,
                        com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event,
                        hudson.model.AbstractProject project)
Schedules a build with parameters from the event.

Parameters:
cause - the cause of the build.
event - the event.
project - the project to build.

doFillVerdictCategoryItems

public hudson.util.ListBoxModel 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 or GerritDefaultValues.DEFAULT_BUILD_SCHEDULE_DELAY.

Returns:
buildScheduleDelay.

createParameters

protected hudson.model.ParametersAction createParameters(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event,
                                                         hudson.model.AbstractProject project)
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.

retriggerThisBuild

public void retriggerThisBuild(TriggerContext context)
Re-triggers the build in TriggerContext.getThisBuild() for the context's event. Will not do any isInteresting(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

public void retriggerAllBuilds(TriggerContext context)
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:
ToGerritRunListener.isBuilding(GerritTriggeredEvent)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

gerritEvent

public void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.events.CommentAdded event)
Called when a CommentAdded event arrives.

Parameters:
event - the event.

getGerritProjects

public List<GerritProject> getGerritProjects()
The list of GerritProject triggering rules.

Returns:
the rule-set.

getDynamicGerritProjects

public List<GerritProject> getDynamicGerritProjects()
The list of dynamically configured triggering rules.

Returns:
the rule-set.

setGerritProjects

public void setGerritProjects(List<GerritProject> gerritProjects)
The list of GerritProject triggering rules.

Parameters:
gerritProjects - the rule-set

getGerritBuildFailedCodeReviewValue

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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

public Integer 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

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.

setBuildUnsuccessfulFilepath

public void setBuildUnsuccessfulFilepath(String path)
Sets the path to a file that contains the unsuccessful Gerrit comment message.

Parameters:
path - The unsuccessful message comment file path

getTriggerOnEvents

public List<PluginGerritEvent> getTriggerOnEvents()
Getter for the triggerOnEvents list.

Returns:
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

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.

isAllowTriggeringUnreviewedPatches

public boolean isAllowTriggeringUnreviewedPatches()
Is checking and triggering missed patches allowed when connection is created.

Returns:
true if checking and triggering missing patches is allowed.

setAllowTriggeringUnreviewedPatches

public void setAllowTriggeringUnreviewedPatches(boolean allowTriggeringUnreviewedPatches)
Set if triggering missing patches configuration should be enabled or not.

Parameters:
allowTriggeringUnreviewedPatches - true if triggering missing patches configuration should be enabled.

getTriggerConfigURL

public String getTriggerConfigURL()
The URL where the trigger configuration should be fetched from.

Returns:
the URL, or null if this feature is not used.

setTriggerConfigURL

public void setTriggerConfigURL(String triggerConfigURL)
Set the URL where the trigger configuration should be fetched from.

Parameters:
triggerConfigURL - the URL where the trigger configuration should be fetched from.

getDependencyJobsNames

public String 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

public void setDependencyJobsNames(String dependencyJobsNames)
Set the list of dependency jobs.

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.

isDelayedApproval

public boolean isDelayedApproval()
If delayed approval is on or off. When delayed approval is on there will be no automatic result of the build sent back to Gerrit. This will have to be sent using a different mechanism. Default is false.

Returns:
true if delayed approval is on.

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

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

public boolean isNoNameAndEmailParameters()
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

public void setNoNameAndEmailParameters(boolean noNameAndEmailParameters)
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

public boolean isReadableMessage()
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

public void setReadableMessage(boolean readableMessage)
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

public String getBuildStartMessage()
The message to show users when a build starts, if custom messages are enabled.

Returns:
The build start message

getBuildSuccessfulMessage

public String getBuildSuccessfulMessage()
The message to show users when a build succeeds, if custom messages are enabled.

Returns:
The build successful message

getBuildUnstableMessage

public String getBuildUnstableMessage()
The message to show users when a build is unstable, if custom messages are enabled.

Returns:
The build unstable message

getBuildFailureMessage

public String getBuildFailureMessage()
The message to show users when a build finishes, if custom messages are enabled.

Returns:
The build failure message

getBuildNotBuiltMessage

public String getBuildNotBuiltMessage()
The message to show users when all builds are not built, if custom messages are enabled.

Returns:
The build not built message

getBuildUnsuccessfulFilepath

public String getBuildUnsuccessfulFilepath()
The path to a file that contains the unsuccessful Gerrit comment message.

Returns:
The unsuccessful message comment file path

setSilentMode

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.

setDelayedApproval

public void setDelayedApproval(boolean delayedApproval)
Sets delayed approval to on or off. When delayed approval is on there will be no automatic result of the build sent back to Gerrit. This will have to be sent using a different mechanism. Default is false.

Parameters:
delayedApproval - true if delayed approval should be on.

getCustomUrl

public String getCustomUrl()
URL to send in comment to Gerrit.

Returns:
custom URL to post back to Gerrit

setCustomUrl

public void setCustomUrl(String customUrl)
Set custom URL to post back to Gerrit.

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

public List<GerritSlave> gerritSlavesToWaitFor(String gerritServerName)
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

public List<hudson.model.Action> getProjectActions()
Overrides:
getProjectActions in class hudson.triggers.Trigger<hudson.model.AbstractProject>

getSkipVote

public SkipVote 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.


Copyright © 2004-2014. All Rights Reserved.