public class NullSCM extends SCM
SCM
.Modifier and Type | Class and Description |
---|---|
static class |
NullSCM.DescriptorImpl |
ExtensionPoint.LegacyInstancesAreScopedToHudson
PERMISSIONS, TAG
Constructor and Description |
---|
NullSCM() |
Modifier and Type | Method and Description |
---|---|
SCMRevisionState |
calcRevisionsFromBuild(Run<?,?> build,
FilePath workspace,
Launcher launcher,
TaskListener listener)
Calculates the
SCMRevisionState that represents the state of the workspace of the given build. |
void |
checkout(Run<?,?> build,
Launcher launcher,
FilePath workspace,
TaskListener listener,
File changelogFile,
SCMRevisionState baseline)
Obtains a fresh workspace of the module(s) into the specified directory
of the specified machine.
|
PollingResult |
compareRemoteRevisionWith(Job<?,?> project,
Launcher launcher,
FilePath workspace,
TaskListener listener,
SCMRevisionState baseline)
Compares the current state of the remote repository against the given baseline
SCMRevisionState . |
ChangeLogParser |
createChangeLogParser()
The returned object will be used to parse
changelog.xml . |
_calcRevisionsFromBuild, _for, _for, all, buildEnvironment, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getBrowser, getDescriptor, getEffectiveBrowser, getKey, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
public SCMRevisionState calcRevisionsFromBuild(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException
SCM
SCMRevisionState
that represents the state of the workspace of the given build.
The returned object is then fed into the
SCM.compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)
method
as the baseline SCMRevisionState
to determine if the build is necessary.
This method is called after source code is checked out for the given build (that is, after
SCM.checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)
has finished successfully.)
The obtained object is added to the build as an Action
for later retrieval. As an optimization,
SCM
implementation can choose to compute SCMRevisionState
and add it as an action
during check out, in which case this method will not called.
calcRevisionsFromBuild
in class SCM
build
- The calculated SCMRevisionState
is for the files checked out in this build.
If SCM.requiresWorkspaceForPolling()
returns true, Hudson makes sure that the workspace of this
build is available and accessible by the callee.workspace
- the location of the checkout; normally not null, since this will normally be called immediately after checkout,
though could be null if data is being loaded from a very old version of Jenkins and the SCM declares that it does not require a workspace for pollinglauncher
- Abstraction of the machine where the polling will take place. Nullness matches that of workspace
.listener
- Logs during the polling should be sent here.InterruptedException
- interruption is usually caused by the user aborting the computation.
this exception should be simply propagated all the way up.IOException
public PollingResult compareRemoteRevisionWith(Job<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException
SCM
SCMRevisionState
.
Conceptually, the act of polling is to take two states of the repository and to compare them to see if there's any difference. In practice, however, comparing two arbitrary repository states is an expensive operation, so in this abstraction, we chose to mix (1) the act of building up a repository state and (2) the act of comparing it with the earlier state, so that SCM implementations can implement this more easily.
Multiple invocations of this method may happen over time to make sure that the remote repository is "quiet" before Hudson schedules a new build.
compareRemoteRevisionWith
in class SCM
project
- The project to check for updateslauncher
- Abstraction of the machine where the polling will take place. If SCM declares
that the polling doesn't require a workspace, this parameter is null.workspace
- The workspace directory that contains baseline files. If SCM declares
that the polling doesn't require a workspace, this parameter is null.listener
- Logs during the polling should be sent here.baseline
- The baseline of the comparison. This object is the return value from earlier
SCM.compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)
or
SCM.calcRevisionsFromBuild(AbstractBuild, Launcher, TaskListener)
.PollingResult
value type.
PollingResult.baseline
should be the value of the baseline parameter, PollingResult.remote
is the current state of the remote repository (this object only needs to be understandable to the future
invocations of this method),
and PollingResult.change
that indicates the degree of changes found during the comparison.InterruptedException
- interruption is usually caused by the user aborting the computation.
this exception should be simply propagated all the way up.IOException
public void checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException
SCM
The "update" operation can be performed instead of a fresh checkout if feasible.
This operation should also capture the information necessary to tag the workspace later.
checkout
in class SCM
launcher
- Abstracts away the machine that the files will be checked out.workspace
- a directory to check out the source code. May contain left-over
from the previous build.changelogFile
- Upon a successful return, this file should capture the changelog.
When there's no change, this file should contain an empty entry.
See SCM.createEmptyChangeLog(File, TaskListener, String)
.
May be null, in which case no changelog was requested.baseline
- version from the previous build to use for changelog creation, if requested and availableAbortException
- in case of a routine failureInterruptedException
- interruption is usually caused by the user aborting the build.
this exception will cause the build to be aborted.IOException
public ChangeLogParser createChangeLogParser()
SCM
changelog.xml
.createChangeLogParser
in class SCM
Copyright © 2004–2021. All rights reserved.