public abstract class SCMListener extends Object implements ExtensionPoint
This is an abstract class so that methods added in the future won't break existing listeners.
Once instantiated, use the register()
method to start receiving events.
Jenkins.getSCMListeners()
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
SCMListener() |
Modifier and Type | Method and Description |
---|---|
static Collection<? extends SCMListener> |
all() |
void |
onChangeLogParsed(AbstractBuild<?,?> build,
BuildListener listener,
ChangeLogSet<?> changelog)
Deprecated.
|
void |
onChangeLogParsed(Run<?,?> build,
SCM scm,
TaskListener listener,
ChangeLogSet<?> changelog)
Called once the changelog is determined.
|
void |
onCheckout(Run<?,?> build,
SCM scm,
FilePath workspace,
TaskListener listener,
File changelogFile,
SCMRevisionState pollingBaseline)
Should be called immediately after
SCM.checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState) is called. |
void |
register()
Deprecated.
Use
Extension instead. |
boolean |
unregister()
Deprecated.
Use
Extension instead. |
public void onCheckout(Run<?,?> build, SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception
SCM.checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)
is called.pollingBaseline
- information about what actually was checked out, if that is available, and this checkout is intended to be included in the build’s polling (if it does any at all)Exception
- if the checkout should be considered failedpublic void onChangeLogParsed(Run<?,?> build, SCM scm, TaskListener listener, ChangeLogSet<?> changelog) throws Exception
During a build, Jenkins fetches the update of the workspace from SCM,
and determines the changelog (see SCM.checkout(hudson.model.Run<?, ?>, hudson.Launcher, hudson.FilePath, hudson.model.TaskListener, java.io.File, hudson.scm.SCMRevisionState)
). Immediately
after that, a build will invoke this method on all registered
SCMListener
s.
If a build failed before we successfully determine changelog, this method will not be invoked (for example, if "cvs update" failed.) OTOH, this method is invoked before the actual build (like ant invocation) happens.
This is an opportunity for SCM-related plugins to act on changelog.
A typical usage includes parsing commit messages and do cross-referencing
between other systems. Implementations can also contribute Action
to AbstractBuild
(by build.getActions().add(...)
to
display additional data on build views.
TODO: once we have cvsnews plugin, refer to its usage.
build
- The build in progress, which just finished determining changelog.
At this point this build is still in progress. Never null.listener
- BuildListener
for on-going build. This can be used to report
any errors or the general logging of what's going on. This will show
up in the "console output" of the build. Never null.changelog
- Set of changes detected in this build. This is the same value
returned from AbstractBuild.getChangeSet()
but passed
separately for convenience.Exception
- If any exception is thrown from this method, it will be recorded
and causes the build to fail.@Deprecated public void onChangeLogParsed(AbstractBuild<?,?> build, BuildListener listener, ChangeLogSet<?> changelog) throws Exception
Exception
public static Collection<? extends SCMListener> all()
@Deprecated public final void register()
Extension
instead.@Deprecated public final boolean unregister()
Extension
instead.Copyright © 2004–2019. All rights reserved.