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 ClassesNested classes/interfaces inherited from class hudson.triggers.Trigger
Trigger.CronNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsFields inherited from class com.github.kostyasha.github.integration.generic.GitHubTrigger
cancelQueued, skipFirstRun -
Constructor Summary
ConstructorsConstructorDescriptionFor groovy UIGitHubPRTrigger(String spec, GitHubPRTriggerMode triggerMode, List<GitHubPREvent> events) -
Method Summary
Modifier and TypeMethodDescriptionvoiddoRun()Blocking run.voidRuns check.booleanvoidDeprecated.Why do we need to pass job here? Trigger.start() should happen when job is configured/loaded...voidvoidrun()non-blocking run.voidsetBranchRestriction(GitHubPRBranchRestriction branchRestriction) voidsetPreStatus(boolean preStatus) voidsetUserRestriction(GitHubPRUserRestriction userRestriction) voidMethods 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, trySaveMethods 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:
startin classGitHubTrigger<GitHubPRTrigger>
-
doRun
public void doRun()Blocking run.- Specified by:
doRunin classGitHubTrigger<GitHubPRTrigger>
-
run
public void run()non-blocking run. -
getPollingLogAction
- Specified by:
getPollingLogActionin classGitHubTrigger<GitHubPRTrigger>
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Trigger<?>>- Overrides:
getDescriptorin 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:
getFinishMsgin classGitHubTrigger<GitHubPRTrigger>
-