|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.triggers.Trigger<hudson.model.AbstractProject>
com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger
public class GerritTrigger
Triggers a build based on Gerrit events.
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 |
---|
@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)
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 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 sen 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 offallowTriggeringUnreviewedPatches
- Is automatic patch checking allowed when connection is establishedtriggerConfigURL
- Where to fetch the configuration file fromMethod Detail |
---|
public Object readResolve() throws ObjectStreamException
readResolve
in class hudson.triggers.Trigger<hudson.model.AbstractProject>
ObjectStreamException
- if something beneath goes wrong.public String getServerName()
public void setServerName(String name)
name
- the name of the newly selected server.public String getGerritSlaveId()
public static GerritTrigger getTrigger(hudson.model.AbstractProject project)
project
- the project.
public void cancelTimer()
public void start(hudson.model.AbstractProject project, boolean newInstance)
start
in class hudson.triggers.Trigger<hudson.model.AbstractProject>
public void stop()
stop
in class hudson.triggers.Trigger<hudson.model.AbstractProject>
public void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
gerritEvent
in interface com.sonymobile.tools.gerrit.gerritevents.GerritEventListener
public void gerritEvent(ManualPatchsetCreated event)
event
- the eventprotected void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
myProject
as the project to build.
cause
- the cause of the build.event
- the event.protected void schedule(GerritCause cause, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, hudson.model.AbstractProject project)
cause
- the cause of the build.event
- the event.project
- the project to build.public hudson.util.ListBoxModel doFillVerdictCategoryItems()
public void notifyBuildEnded(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
event
- the event.public int getBuildScheduleDelay()
GerritDefaultValues.DEFAULT_BUILD_SCHEDULE_DELAY
.
protected hudson.model.ParametersAction createParameters(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, hudson.model.AbstractProject project)
event
- the event.project
- the project.
public void retriggerThisBuild(TriggerContext context)
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.
context
- the previous context.public void retriggerAllBuilds(TriggerContext context)
context
- the context to rebuild.ToGerritRunListener.isBuilding(GerritTriggeredEvent)
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.events.CommentAdded event)
event
- the event.public List<GerritProject> getGerritProjects()
public List<GerritProject> getDynamicGerritProjects()
public void setGerritProjects(List<GerritProject> gerritProjects)
gerritProjects
- the rule-setpublic Integer getGerritBuildFailedCodeReviewValue()
public void setGerritBuildFailedCodeReviewValue(Integer gerritBuildFailedCodeReviewValue)
gerritBuildFailedCodeReviewValue
- the vote value.public Integer getGerritBuildFailedVerifiedValue()
public void setGerritBuildFailedVerifiedValue(Integer gerritBuildFailedVerifiedValue)
gerritBuildFailedVerifiedValue
- the vote value.public Integer getGerritBuildStartedCodeReviewValue()
public void setGerritBuildStartedCodeReviewValue(Integer gerritBuildStartedCodeReviewValue)
gerritBuildStartedCodeReviewValue
- the vote value.public Integer getGerritBuildStartedVerifiedValue()
public void setGerritBuildStartedVerifiedValue(Integer gerritBuildStartedVerifiedValue)
gerritBuildStartedVerifiedValue
- the vote value.public Integer getGerritBuildSuccessfulCodeReviewValue()
public void setGerritBuildSuccessfulCodeReviewValue(Integer gerritBuildSuccessfulCodeReviewValue)
gerritBuildSuccessfulCodeReviewValue
- the vote value.public Integer getGerritBuildSuccessfulVerifiedValue()
public void setGerritBuildSuccessfulVerifiedValue(Integer gerritBuildSuccessfulVerifiedValue)
gerritBuildSuccessfulVerifiedValue
- the vote value.public Integer getGerritBuildUnstableCodeReviewValue()
public void setGerritBuildUnstableCodeReviewValue(Integer gerritBuildUnstableCodeReviewValue)
gerritBuildUnstableCodeReviewValue
- the vote value.public Integer getGerritBuildUnstableVerifiedValue()
public void setGerritBuildUnstableVerifiedValue(Integer gerritBuildUnstableVerifiedValue)
gerritBuildUnstableVerifiedValue
- the vote value.public Integer getGerritBuildNotBuiltCodeReviewValue()
public void setGerritBuildNotBuiltCodeReviewValue(Integer gerritBuildNotBuiltCodeReviewValue)
gerritBuildNotBuiltCodeReviewValue
- the vote value.public Integer getGerritBuildNotBuiltVerifiedValue()
public void setGerritBuildNotBuiltVerifiedValue(Integer gerritBuildNotBuiltVerifiedValue)
gerritBuildNotBuiltVerifiedValue
- the vote value.public void setBuildUnsuccessfulFilepath(String path)
path
- The unsuccessful message comment file pathpublic List<PluginGerritEvent> getTriggerOnEvents()
public boolean isDynamicTriggerConfiguration()
public void setDynamicTriggerConfiguration(boolean dynamicTriggerConfiguration)
dynamicTriggerConfiguration
- true if dynamic trigger configuration should be enabled.public boolean isAllowTriggeringUnreviewedPatches()
public void setAllowTriggeringUnreviewedPatches(boolean allowTriggeringUnreviewedPatches)
allowTriggeringUnreviewedPatches
- true if triggering missing patches configuration should be enabled.public String getTriggerConfigURL()
public void setTriggerConfigURL(String triggerConfigURL)
triggerConfigURL
- the URL where the trigger configuration should be fetched from.public String getDependencyJobsNames()
public void setDependencyJobsNames(String dependencyJobsNames)
dependencyJobsNames
- the string containing a comma-separated list of job names.public boolean isSilentMode()
public boolean isDelayedApproval()
public boolean isEscapeQuotes()
public void setEscapeQuotes(boolean escapeQuotes)
escapeQuotes
- is true if escapeQuotes should be on.public boolean isNoNameAndEmailParameters()
public void setNoNameAndEmailParameters(boolean noNameAndEmailParameters)
noNameAndEmailParameters
- is true if problematic parameters should be omitted.public boolean isReadableMessage()
public void setReadableMessage(boolean readableMessage)
readableMessage
- is true if human readable message is set.public String getBuildStartMessage()
public String getBuildSuccessfulMessage()
public String getBuildUnstableMessage()
public String getBuildFailureMessage()
public String getBuildNotBuiltMessage()
public String getBuildUnsuccessfulFilepath()
public void setSilentMode(boolean silentMode)
silentMode
- true if silent mode should be on.public void setDelayedApproval(boolean delayedApproval)
delayedApproval
- true if delayed approval should be on.public String getCustomUrl()
public void setCustomUrl(String customUrl)
customUrl
- URL to setpublic boolean isFileTriggerEnabled()
public void updateTriggerConfigURL()
public boolean isTriggerOnDraftPublishedEnabled()
public List<GerritSlave> gerritSlavesToWaitFor(String gerritServerName)
gerritServerName
- The Gerrit server name
public List<hudson.model.Action> getProjectActions()
getProjectActions
in class hudson.triggers.Trigger<hudson.model.AbstractProject>
public SkipVote getSkipVote()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |