Class SCMCheckoutStrategy
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<SCMCheckoutStrategy>
-
- jenkins.scm.SCMCheckoutStrategy
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCMCheckoutStrategy>
- Direct Known Subclasses:
DefaultSCMCheckoutStrategyImpl
public abstract class SCMCheckoutStrategy extends AbstractDescribableImpl<SCMCheckoutStrategy> implements ExtensionPoint
Controls the check out behavior inAbstractBuild
.While this can work with any
AbstractBuild
, the primary motivation of this extension point is to control the check out behaviour in matrix projects. The intended use cases include situations like:- Check out will only happen once in
MatrixBuild
, and its state will be then sent toMatrixRun
s by other means such as rsync. MatrixBuild
does no check out of its own, and check out is only done onMatrixRun
s
Hook Semantics
There are currently two hooks defined on this class:pre checkout
The default implementation calls into
BuildWrapper.preCheckout(AbstractBuild, Launcher, BuildListener)
calls. You can override this method to do something before/after this, but you must still call into thesuper.preCheckout
so that matrix projects can satisfy the contract withBuildWrapper
s.checkout
The default implementation uses
AbstractProject.checkout(AbstractBuild, Launcher, BuildListener, File)
to letSCM
do check out, but yourSCMCheckoutStrategy
impls can substitute this call with other operations that substitutes this semantics.State and concurrency
An instance of this object gets created for a project for which this strategy is configured, so the subtype needs to avoid using instance variables to refer to build-specific state (such as
BuildListener
s.) Similarly, methods can be invoked concurrently. The code executes on the master, even if builds are running remotely.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description SCMCheckoutStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkout(AbstractBuild.AbstractBuildExecution execution)
Performs the checkout step.SCMCheckoutStrategyDescriptor
getDescriptor()
By default looks for a nested class (conventionally namedDescriptorImpl
) implementingDescriptor
and marked withExtension
.void
preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
Performs the pre checkout step.
-
-
-
Method Detail
-
preCheckout
public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
Performs the pre checkout step. This method is called by theExecutor
that's carrying out the build.- Parameters:
build
- Build being in progress. Never null.launcher
- Allows you to launch process on the node where the build is actually running. Never null.listener
- Allows you to write to console output and report errors. Never null.- Throws:
IOException
InterruptedException
-
checkout
public void checkout(AbstractBuild.AbstractBuildExecution execution) throws IOException, InterruptedException
Performs the checkout step. SeepreCheckout(AbstractBuild, Launcher, BuildListener)
for the semantics of the parameters.- Throws:
IOException
InterruptedException
-
getDescriptor
public SCMCheckoutStrategyDescriptor getDescriptor()
Description copied from class:AbstractDescribableImpl
By default looks for a nested class (conventionally namedDescriptorImpl
) implementingDescriptor
and marked withExtension
.Gets the descriptor for this instance.
Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<SCMCheckoutStrategy>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<SCMCheckoutStrategy>
-
-