public abstract class SCMCheckoutStrategy extends AbstractDescribableImpl<SCMCheckoutStrategy> implements ExtensionPoint
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:
MatrixBuild
, and its state will be then sent
to MatrixRun
s by other means such as rsync.
MatrixBuild
does no check out of its own, and check out is only done on MatrixRun
s
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 BuildWrapper
s.
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.
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.
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
SCMCheckoutStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
checkout(AbstractBuild.AbstractBuildExecution execution)
Performs the checkout step.
|
SCMCheckoutStrategyDescriptor |
getDescriptor()
By default looks for a nested class (conventionally named
DescriptorImpl ) implementing Descriptor and marked with Extension . |
void |
preCheckout(AbstractBuild<?,?> build,
Launcher launcher,
BuildListener listener)
Performs the pre checkout step.
|
public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
Executor
that's carrying out the build.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.IOException
InterruptedException
public void checkout(AbstractBuild.AbstractBuildExecution execution) throws IOException, InterruptedException
preCheckout(AbstractBuild, Launcher, BuildListener)
for the semantics of the parameters.IOException
InterruptedException
public SCMCheckoutStrategyDescriptor getDescriptor()
AbstractDescribableImpl
DescriptorImpl
) implementing Descriptor
and marked with Extension
.
Gets the descriptor for this instance.
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<SCMCheckoutStrategy>
getDescriptor
in class AbstractDescribableImpl<SCMCheckoutStrategy>
Copyright © 2004–2021. All rights reserved.