Class SCMCheckoutStrategy
- All Implemented Interfaces:
ExtensionPoint,Describable<SCMCheckoutStrategy>
- Direct Known Subclasses:
DefaultSCMCheckoutStrategyImpl
AbstractBuild.
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 toMatrixRuns by other means such as rsync. MatrixBuilddoes no check out of its own, and check out is only done onMatrixRuns
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 the super.preCheckout
so that matrix projects can satisfy the contract with BuildWrappers.
checkout
The default implementation uses AbstractProject.checkout(AbstractBuild, Launcher, BuildListener, File) to
let SCM do check out, but your SCMCheckoutStrategy 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 BuildListeners.)
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckout(AbstractBuild.AbstractBuildExecution execution) Performs the checkout step.Gets the descriptor for this instance.voidpreCheckout(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) Performs the pre checkout step.
-
Constructor Details
-
SCMCheckoutStrategy
public SCMCheckoutStrategy()
-
-
Method Details
-
preCheckout
public void preCheckout(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedExceptionPerforms the pre checkout step. This method is called by theExecutorthat'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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
getDescriptor
Description copied from interface:DescribableGets the descriptor for this instance.Descriptoris a singleton for every concreteDescribableimplementation, 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.)By default looks for a nested class (conventionally named
DescriptorImpl) implementingDescriptorand marked withExtension.- Specified by:
getDescriptorin interfaceDescribable<SCMCheckoutStrategy>
-