Class GitHubPRTrigger
java.lang.Object
hudson.triggers.Trigger<Job<?,?>>
com.github.kostyasha.github.integration.generic.GitHubTrigger<GitHubPRTrigger>
org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
- All Implemented Interfaces:
ExtensionPoint
,Describable<Trigger<?>>
GitHub Pull Request trigger.
Planned trigger modes:
- just incoming hooks, without persist (save PR state to local xml)
- hooks with persist
- cron run, persist
Restrictions can't have resolver, so they separate and provide security check methods:
- Target branch restriction GitHubPRUserRestriction
- User restriction (check comments, labels, etc)
GitHubPRUserRestriction
(whitelist manipulations using comments is also allowed)
Event triggering is modular. Now they can be split to any events: - Trigger by comment - Trigger when PR opened - Trigger when PR closed - Trigger by label - etc.
- Author:
- Kanstantsin Shautsou
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.triggers.Trigger
Trigger.Cron
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class com.github.kostyasha.github.integration.generic.GitHubTrigger
cancelQueued, skipFirstRun
-
Constructor Summary
ConstructorDescriptionFor groovy UIGitHubPRTrigger
(String spec, GitHubPRTriggerMode triggerMode, List<GitHubPREvent> events) -
Method Summary
Modifier and TypeMethodDescriptionvoid
doRun()
Blocking run.void
Runs check.boolean
void
Deprecated.Why do we need to pass job here? Trigger.start() should happen when job is configured/loaded...void
void
run()
non-blocking run.void
setBranchRestriction
(GitHubPRBranchRestriction branchRestriction) void
setPreStatus
(boolean preStatus) void
setUserRestriction
(GitHubPRUserRestriction userRestriction) void
Methods inherited from class com.github.kostyasha.github.integration.generic.GitHubTrigger
getErrorsAction, getJob, getProjectActions, getRemoteRepository, getRepoFullName, getRepoFullName, getRepoName, getRepoProvider, getRepoProviders, getTriggerMode, isAbortRunning, isCancelQueued, isSkipFirstRun, saveIfSkipFirstRun, setAbortRunning, setCancelQueued, setRepoName, setRepoProvider, setRepoProviders, setSkipFirstRun, setTriggerMode, stop, trySave
Methods inherited from class hudson.triggers.Trigger
all, checkTriggers, for_, getProjectAction, getSpec, readResolve, toString
-
Field Details
-
FINISH_MSG
- See Also:
-
-
Constructor Details
-
GitHubPRTrigger
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public GitHubPRTrigger() throws ANTLRExceptionFor groovy UI- Throws:
ANTLRException
-
GitHubPRTrigger
@DataBoundConstructor public GitHubPRTrigger(String spec, GitHubPRTriggerMode triggerMode, List<GitHubPREvent> events) throws ANTLRException - Throws:
ANTLRException
-
-
Method Details
-
setPreStatus
@DataBoundSetter public void setPreStatus(boolean preStatus) -
setUserRestriction
-
setBranchRestriction
-
isPreStatus
public boolean isPreStatus() -
getEvents
-
getUserRestriction
-
getBranchRestriction
-
start
- Overrides:
start
in classGitHubTrigger<GitHubPRTrigger>
-
doRun
public void doRun()Blocking run.- Specified by:
doRun
in classGitHubTrigger<GitHubPRTrigger>
-
run
public void run()non-blocking run. -
getPollingLogAction
- Specified by:
getPollingLogAction
in classGitHubTrigger<GitHubPRTrigger>
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<Trigger<?>>
- Overrides:
getDescriptor
in classTrigger<Job<?,
?>>
-
queueRun
Deprecated.Why do we need to pass job here? Trigger.start() should happen when job is configured/loaded...For running from external places. Goes to queue. -
queueRun
-
doRun
Runs check. Synchronised because localRepository state is persisted after trigger decisions were made. When multiple events triggering runs in queue they triggering builds in parallel. TODO implement special queue for parallel prNumbers scans and make polling long async.- Parameters:
prNumber
- - PR number for check, if null - then all PRs
-
getFinishMsg
- Specified by:
getFinishMsg
in classGitHubTrigger<GitHubPRTrigger>
-