public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>> extends Run<P,R> implements Queue.Executable, LazyBuildMixIn.LazyLoadingRun<P,R>, RunWithSCM<P,R>
Run
s that build software.
For now this is primarily the common part of Build
and MavenBuild.AbstractProject
Modifier and Type | Class and Description |
---|---|
class |
AbstractBuild.AbstractBuildExecution |
class |
AbstractBuild.AbstractRunner
Deprecated.
as of 1.467
Please use
Run.RunExecution |
static class |
AbstractBuild.DependencyChange
Represents a change in the dependency.
|
Run.Artifact, Run.ArtifactList, Run.KeepLogBuildBadge, Run.RedirectUp, Run.RunExecution, Run.Runner, Run.RunnerAbortedException, Run.StatusSummarizer, Run.Summary
ExtensionPoint.LegacyInstancesAreScopedToHudson
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
Modifier and Type | Field and Description |
---|---|
protected List<Environment> |
buildEnvironments
During the build this field remembers
BuildWrapper.Environment s created by
BuildWrapper . |
ARTIFACTS, charset, DELETE, description, duration, FEED_ADAPTER, FEED_ADAPTER_LATEST, LIST_CUTOFF, nextBuild, number, ORDER_BY_DATE, PERMISSIONS, previousBuild, project, QUEUE_ID_UNKNOWN, result, SKIP_PERMISSION_CHECK, timestamp, TREE_CUTOFF, UPDATE, XSTREAM, XSTREAM2
Modifier | Constructor and Description |
---|---|
protected |
AbstractBuild(P job) |
protected |
AbstractBuild(P job,
Calendar timestamp) |
protected |
AbstractBuild(P project,
File buildDir) |
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action a)
Adds a new action.
|
Set<User> |
calculateCulprits()
Method used for actually calculating the culprits from scratch.
|
protected BuildReference<R> |
createReference()
Called by
RunMap to obtain a reference to this run. |
org.kohsuke.stapler.HttpResponse |
doStop()
Stops this build if it's still going.
|
void |
doStop(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Deprecated.
as of 1.489
Use
doStop() |
protected void |
dropLinks()
Called by
RunMap to drop bi-directional links in preparation for
deleting a build. |
Calendar |
due() |
Action |
getAggregatedTestResultAction()
Deprecated.
Use
Actionable.getAction(Class) on AggregatedTestResultAction . |
VariableResolver<String> |
getBuildVariableResolver()
Creates
VariableResolver backed by getBuildVariables() . |
Map<String,String> |
getBuildVariables()
Provides additional variables and their values to
Builder s. |
Node |
getBuiltOn()
Returns a
Slave on which this build was done. |
String |
getBuiltOnStr()
Returns the name of the agent it was built on; null or "" if built by the master.
|
ChangeLogSet<? extends ChangeLogSet.Entry> |
getChangeSet()
Gets the changes incorporated into this build.
|
List<ChangeLogSet<? extends ChangeLogSet.Entry>> |
getChangeSets()
Gets all
ChangeLogSet s currently associated with this item. |
Set<String> |
getCulpritIds()
Gets the ids for all
User s included in RunWithSCM.getChangeSets() for this item. |
Set<User> |
getCulprits()
List of users who committed a change since the last non-broken build till now.
|
Map<AbstractProject,AbstractBuild.DependencyChange> |
getDependencyChanges(AbstractBuild from)
Gets the changes in the dependency between the given build and this build.
|
Map<AbstractProject,Fingerprint.RangeSet> |
getDownstreamBuilds()
Gets the downstream builds of this build, which are the builds of the
downstream projects that use artifacts of this build.
|
Iterable<AbstractBuild<?,?>> |
getDownstreamBuilds(AbstractProject<?,?> that)
Works like
getDownstreamRelationship(AbstractProject) but returns
the actual build objects, in ascending order. |
Fingerprint.RangeSet |
getDownstreamRelationship(AbstractProject that)
Gets the dependency relationship from this build (as the source)
and that project (as the sink.)
|
EnvVars |
getEnvironment(TaskListener log)
Returns the map that contains environmental variables to be used for launching
processes for this build.
|
EnvironmentList |
getEnvironments()
During the build, expose the environments contributed by
BuildWrapper s and others. |
String |
getHudsonVersion()
Gets the version of Hudson that was used to build this job.
|
FilePath |
getModuleRoot()
Returns the root directory of the checked-out module.
|
FilePath[] |
getModuleRoots()
Returns the root directories of all checked-out modules.
|
R |
getNextBuild() |
List<Action> |
getPersistentActions() |
R |
getPreviousBuild() |
P |
getProject() |
AbstractBuild<?,?> |
getRootBuild()
Gets the nearest ancestor
AbstractBuild that belongs to
the root project of getProject() that
dominates/governs/encompasses this build. |
LazyBuildMixIn.RunMixIn<P,R> |
getRunMixIn() |
Set<String> |
getSensitiveBuildVariables()
Builds up a set of variable names that contain sensitive values that
should not be exposed.
|
Action |
getTestResultAction()
Deprecated.
Use
Actionable.getAction(Class) on AbstractTestResultAction . |
Map<AbstractProject,Integer> |
getTransitiveUpstreamBuilds()
Works like
getUpstreamBuilds() but also includes all the transitive
dependencies as well. |
Map<AbstractProject,Integer> |
getUpstreamBuilds()
Gets the upstream builds of this build, which are the builds of the
upstream projects whose artifacts feed into this build.
|
int |
getUpstreamRelationship(AbstractProject that)
Gets the dependency relationship from this build (as the sink)
and that project (as the source.)
|
AbstractBuild<?,?> |
getUpstreamRelationshipBuild(AbstractProject<?,?> that)
Works like
getUpstreamRelationship(AbstractProject) but returns the
actual build object. |
String |
getUpUrl()
Used to render the side panel "Back to project" link.
|
String |
getWhyKeepLog()
If
Run.isKeepLog() returns true, returns a short, human-readable
sentence that explains why it's being kept. |
FilePath |
getWorkspace()
Gets the directory where this build is being built.
|
boolean |
hasChangeSetComputed()
Returns true if the changelog is already computed.
|
abstract void |
run()
Invoked by
Executor to performs a build. |
protected void |
setBuiltOnStr(String builtOn)
Allows subtypes to set the value of
builtOn . |
protected void |
setWorkspace(FilePath ws)
Normally, a workspace is assigned by
Run.RunExecution , but this lets you set the workspace in case
AbstractBuild is created without a build. |
boolean |
shouldCalculateCulprits()
Determines whether culprits should be recalcuated or the existing
RunWithSCM.getCulpritIds() should be used instead. |
_this, canToggleLogKeep, compareTo, delete, deleteArtifacts, doArtifact, doBuildNumber, doBuildStatus, doBuildTimestamp, doConfigSubmit, doConsoleText, doDoDelete, doProgressiveLog, doSubmitDescription, doToggleLogKeep, execute, fromExternalizableId, getAbsoluteUrl, getACL, getApi, getArtifactManager, getArtifacts, getArtifactsDir, getArtifactsUpTo, getBadgeActions, getBuildFingerprints, getBuildsOverThreshold, getBuildStatusIconClassName, getBuildStatusSummary, getBuildStatusUrl, getCause, getCauses, getCharacteristicEnvVars, getCharset, getDescription, getDisplayName, getDuration, getDurationString, getDynamic, getEnvironment, getEnvVars, getEstimatedDuration, getExecutor, getExternalizableId, getFullDisplayName, getHasArtifacts, getIconColor, getId, getLog, getLog, getLogFile, getLogInputStream, getLogReader, getLogText, getNumber, getOneOffExecutor, getParent, getPreviousBuildInProgress, getPreviousBuildsOverThreshold, getPreviousBuiltBuild, getPreviousCompletedBuild, getPreviousFailedBuild, getPreviousNotFailedBuild, getPreviousSuccessfulBuild, getQueueId, getResult, getRootDir, getSearchUrl, getStartTimeInMillis, getTarget, getTime, getTimeInMillis, getTimestamp, getTimestampString, getTimestampString2, getTransientActions, getTruncatedDescription, getUrl, hasCustomDisplayName, hasntStartedYet, isBuilding, isInProgress, isKeepLog, isLogUpdated, keepLog, keepLog, makeSearchIndex, onEndBuilding, onLoad, onStartBuilding, pickArtifactManager, reload, run, save, setDescription, setDisplayName, setQueueId, setResult, submit, toString, updateSymlinks, writeLogTo, writeReplace, writeWholeLogTo
addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, removeAction, removeActions, replaceAction, replaceActions
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEstimatedDuration, getParent, toString
hasParticipant
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
getDescriptorByName
protected transient List<Environment> buildEnvironments
BuildWrapper.Environment
s created by
BuildWrapper
. This design is bit ugly but forced due to compatibility.protected AbstractBuild(P job) throws IOException
IOException
protected AbstractBuild(P project, File buildDir) throws IOException
IOException
public final P getProject()
public final LazyBuildMixIn.RunMixIn<P,R> getRunMixIn()
getRunMixIn
in interface LazyBuildMixIn.LazyLoadingRun<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
protected final BuildReference<R> createReference()
Run
RunMap
to obtain a reference to this run.createReference
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.RunMixIn.createReference()
protected final void dropLinks()
Run
RunMap
to drop bi-directional links in preparation for
deleting a build.dropLinks
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.RunMixIn.dropLinks()
public R getPreviousBuild()
getPreviousBuild
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.RunMixIn.getPreviousBuild()
public R getNextBuild()
getNextBuild
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.RunMixIn.getNextBuild()
@CheckForNull public Node getBuiltOn()
Slave
on which this build was done.@Exported(name="builtOn") public String getBuiltOnStr()
protected void setBuiltOnStr(String builtOn)
builtOn
.
This is used for those implementations where an AbstractBuild
is made 'built' without
actually running its run()
method.public AbstractBuild<?,?> getRootBuild()
AbstractBuild
that belongs to
the root project of getProject() that
dominates/governs/encompasses this build.
Some projects (such as matrix projects, Maven projects, or promotion processes) form a tree of jobs, and still in some of them, builds of child projects are related/tied to that of the parent project. In such a case, this method returns the governing build.
AbstractProject.getRootProject()
public String getUpUrl()
In a rare situation where a build can be reached from multiple paths, returning different URLs from this method based on situations might be desirable.
If you override this method, you'll most likely also want to override
Run.getDisplayName()
.
@CheckForNull public final FilePath getWorkspace()
Note to implementors: to control where the workspace is created, override
AbstractBuild.AbstractBuildExecution.decideWorkspace(Node,WorkspaceList)
.
protected void setWorkspace(@NonNull FilePath ws)
Run.RunExecution
, but this lets you set the workspace in case
AbstractBuild
is created without a build.public final FilePath getModuleRoot()
This is usually where pom.xml
, build.xml
and so on exists.
public FilePath[] getModuleRoots()
Some SCMs support checking out multiple modules into the same workspace. In these cases, the returned array will have a length greater than one.
@CheckForNull public Set<String> getCulpritIds()
RunWithSCM
User
s included in RunWithSCM.getChangeSets()
for this item.getCulpritIds
in interface RunWithSCM<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
RunWithSCM
instance with no culprits.@Exported @NonNull public Set<User> getCulprits()
RunWithSCM
This list at least always include people who made changes in this build, but if the previous build was a failure it also includes the culprit list from there.
Missing User
s will be created on-demand.
getCulprits
in interface RunWithSCM<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public boolean shouldCalculateCulprits()
RunWithSCM
RunWithSCM.getCulpritIds()
should be used instead.shouldCalculateCulprits
in interface RunWithSCM<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
@NonNull public Set<User> calculateCulprits()
RunWithSCM
RunWithSCM.getCulprits()
and
overrides of RunWithSCM.getCulprits()
. Does not persist culprits information.calculateCulprits
in interface RunWithSCM<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Set
of User
s associated with this item.public String getHudsonVersion()
@Exported @NonNull public ChangeLogSet<? extends ChangeLogSet.Entry> getChangeSet()
@NonNull public List<ChangeLogSet<? extends ChangeLogSet.Entry>> getChangeSets()
RunWithSCM
ChangeLogSet
s currently associated with this item.getChangeSets
in interface RunWithSCM<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
ChangeLogSet
s.public boolean hasChangeSetComputed()
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException
Run
BuildStep
s that invoke external processes should use this.
This allows BuildWrapper
s and other project configurations (such as JDK selection)
to take effect.
Unlike earlier Run.getEnvVars()
, this map contains the whole environment,
not just the overrides, so one can introspect values to change its behavior.
getEnvironment
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
InterruptedException
public EnvironmentList getEnvironments()
BuildWrapper
s and others.
Since 1.444, executor thread that's doing the build can access mutable underlying list,
which allows the caller to add/remove environments. The recommended way of adding
environment is through BuildWrapper
, but this might be handy for build steps
who wants to expose additional environment variables to the rest of the build.
public Calendar due()
public void addAction(Action a)
Actionable.getAllActions()
that happen before calls to this method may not see the update.
Note: this method will always modify the actions
A RunAction2
is handled specially.
The action may have a summary.jelly
view containing a <t:summary>
or other <tr>
.addAction
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public Set<String> getSensitiveBuildVariables()
getBuildVariables()
that should have their
values masked for display purposes.public Map<String,String> getBuildVariables()
Builder
s.
This mechanism is used by MatrixConfiguration
to pass
the configuration values to the current build. It is up to
Builder
s to decide whether they want to recognize the values
or how to use them.
This also includes build parameters if a build is parameterized.
public final VariableResolver<String> getBuildVariableResolver()
VariableResolver
backed by getBuildVariables()
.@Deprecated public Action getTestResultAction()
Actionable.getAction(Class)
on AbstractTestResultAction
.@Deprecated public Action getAggregatedTestResultAction()
Actionable.getAction(Class)
on AggregatedTestResultAction
.public abstract void run()
Executor
to performs a build.run
in interface Queue.Executable
run
in interface Runnable
public String getWhyKeepLog()
Run
Run.isKeepLog()
returns true, returns a short, human-readable
sentence that explains why it's being kept.getWhyKeepLog
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that)
Fingerprinter.FingerprintAction
), but it'll never be null.public Iterable<AbstractBuild<?,?>> getDownstreamBuilds(AbstractProject<?,?> that)
getDownstreamRelationship(AbstractProject)
but returns
the actual build objects, in ascending order.public int getUpstreamRelationship(AbstractProject that)
Fingerprinter.FingerprintAction
, even if there is an Cause.UpstreamCause
).public AbstractBuild<?,?> getUpstreamRelationshipBuild(AbstractProject<?,?> that)
getUpstreamRelationship(AbstractProject)
but returns the
actual build object.public Map<AbstractProject,Fingerprint.RangeSet> getDownstreamBuilds()
AbstractProject.isFingerprintConfigured()
.)public Map<AbstractProject,Integer> getUpstreamBuilds()
Fingerprinter.FingerprintAction
(even if there is an Cause.UpstreamCause
)getTransitiveUpstreamBuilds()
public Map<AbstractProject,Integer> getTransitiveUpstreamBuilds()
getUpstreamBuilds()
but also includes all the transitive
dependencies as well.public Map<AbstractProject,AbstractBuild.DependencyChange> getDependencyChanges(AbstractBuild from)
Fingerprinter.FingerprintAction
@Deprecated public void doStop(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
doStop()
IOException
javax.servlet.ServletException
public org.kohsuke.stapler.HttpResponse doStop() throws IOException, javax.servlet.ServletException
Run.getExecutor()
returns null.IOException
javax.servlet.ServletException
Copyright © 2004–2021. All rights reserved.