Class IvyReporter
- All Implemented Interfaces:
ExtensionPoint,Describable<IvyReporter>,Serializable
IvyBuild,
and normally records some information and exposes these
in IvyBuild later.
IvyReporter is first instantiated on the master.
Then during the build, it is serialized and sent over into
the Ant process by serialization. Reporters will then receive
event callbacks as Ant build events. Those event callbacks
are the ones that take IvyBuildProxy.
Once the Ant build completes normally or abnormally, the reporters
will be sent back to the master by serialization again, then
have its end(IvyBuild, Launcher, BuildListener) method invoked.
This is a good opportunity to perform the post-build action.
This is the IvyBuild equivalent of BuildStep. Instances
of IvyReporters are persisted with IvyModule/IvyModuleSet,
possibly with configuration specific to that job.
Callback Firing Sequence
The callback methods are invoked in the following order:
SEQUENCE := preBuild MODULE* postBuild end MODULE := enterModule leaveModule
When an error happens, the call sequence could be terminated at any point and no further callback methods may be invoked.
Action
IvyReporter can contribute
Action to IvyBuild so that the report can be displayed
in the web UI.
Such action can also implement AggregatableAction if it further
wishes to contribute a separate action to IvyModuleSetBuild.
This mechanism is usually used to provide aggregated report for all the
module builds.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanend(IvyBuild build, Launcher launcher, BuildListener listener) Called after the Ant/Ivy execution finished and the result is determined.booleanenterModule(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) Called when the build enters a nextAbstractIvyProject.getAggregatedProjectAction(IvyModuleSet project) Works likegetProjectAction(IvyModule)but works atIvyModuleSetlevel.getProjectAction(IvyModule module) Deprecated.Collection<? extends Action>getProjectActions(IvyModule module) Equivalent ofBuildStep.getProjectActions(AbstractProject)forIvyReporter.booleanleaveModule(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) Called when the build leaves the currentAbstractIvyProject.booleanpostBuild(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) Called after a build of one Ivy module is completed.booleanpreBuild(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) Called before the actual ant execution begins.
-
Constructor Details
-
IvyReporter
public IvyReporter()
-
-
Method Details
-
preBuild
public boolean preBuild(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) throws InterruptedException, IOException Called before the actual ant execution begins.- Returns:
- true if the build can continue, false if there was an error and the build needs to be aborted.
- Throws:
InterruptedException- If the build is interrupted by the user (in an attempt to abort the build.) Normally theIvyReporterimplementations may simply forward the exception it got from its lower-level functions.IOException- If the implementation wants to abort the processing when anIOExceptionhappens, it can simply propagate the exception to the caller. This will cause the build to fail, with the default error message. Implementations are encouraged to catchIOExceptionon its own to provide a better error message, if it can do so, so that users have better understanding on why it failed.
-
enterModule
public boolean enterModule(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) throws InterruptedException, IOException Called when the build enters a nextAbstractIvyProject.When the current build is a multi-module reactor build, every time the build moves on to the next module, this method will be invoked.
- Returns:
- See
preBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener) - Throws:
InterruptedException- SeepreBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener)IOException- SeepreBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener)
-
leaveModule
public boolean leaveModule(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) throws InterruptedException, IOException Called when the build leaves the currentAbstractIvyProject. -
postBuild
public boolean postBuild(IvyBuildProxy build, org.apache.tools.ant.BuildEvent event, BuildListener listener) throws InterruptedException, IOException Called after a build of one Ivy module is completed.Note that at this point the build result is still not determined.
- Returns:
- See
preBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener) - Throws:
InterruptedException- SeepreBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener)IOException- SeepreBuild(hudson.ivy.IvyBuildProxy, org.apache.tools.ant.BuildEvent, hudson.model.BuildListener)
-
end
public boolean end(IvyBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException Called after the Ant/Ivy execution finished and the result is determined.This method fires after
postBuild(IvyBuildProxy, BuildEvent, BuildListener). Works likeBuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener).- Throws:
InterruptedExceptionIOException
-
getProjectAction
Deprecated.as of 1.21 UsegetProjectActions(IvyModule)instead.Equivalent ofBuildStep.getProjectAction(AbstractProject)forIvyReporter.Registers a transient action to
IvyModulewhen it's rendered. This is useful if you'd like to display an action at the module level.Since this contributes a transient action, the returned
Actionwill not be serialized.For this method to be invoked, your
IvyReporterhas to invokeIvyBuildProxy.registerAsProjectAction(IvyReporter)during the build.- Returns:
- null not to contribute an action, which is the default.
-
getProjectActions
Equivalent ofBuildStep.getProjectActions(AbstractProject)forIvyReporter.Registers a transient action to
IvyModulewhen it's rendered. This is useful if you'd like to display an action at the module level.Since this contributes a transient action, the returned
Actionwill not be serialized.For this method to be invoked, your
IvyReporterhas to invokeIvyBuildProxy.registerAsProjectAction(IvyReporter)during the build.- Returns:
- can be empty but never null.
- Since:
- 1.21
-
getAggregatedProjectAction
Works likegetProjectAction(IvyModule)but works atIvyModuleSetlevel.For this method to be invoked, your
IvyReporterhas to invokeIvyBuildProxy.registerAsAggregatedProjectAction(IvyReporter)during the build.- Returns:
- null not to contribute an action, which is the default.
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<IvyReporter>
-
getProjectActions(IvyModule)instead.