|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.Run<P,R>
hudson.model.AbstractBuild<P,R>
public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
Base implementation of Run
s that build software.
For now this is primarily the common part of Build
and MavenBuild.
AbstractProject
Nested Class Summary | |
---|---|
class |
AbstractBuild.AbstractBuildExecution
|
class |
AbstractBuild.AbstractRunner
Deprecated. as of 1.467 Please use RunExecution |
static class |
AbstractBuild.DependencyChange
Represents a change in the dependency. |
Nested classes/interfaces inherited from class hudson.model.Run |
---|
Run.Artifact, Run.ArtifactList, Run.KeepLogBuildBadge, Run.RedirectUp, Run.RunExecution, Run.Runner, Run.RunnerAbortedException, Run.Summary |
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu |
---|
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem |
Field Summary | |
---|---|
protected List<Environment> |
buildEnvironments
During the build this field remembers BuildWrapper.Environment s created by
BuildWrapper . |
Fields inherited from class hudson.model.Run |
---|
ARTIFACTS, charset, DELETE, description, duration, FEED_ADAPTER, FEED_ADAPTER_LATEST, ID_FORMATTER, LIST_CUTOFF, number, ORDER_BY_DATE, PERMISSIONS, project, result, state, timestamp, TREE_CUTOFF, UPDATE, XSTREAM, XSTREAM2 |
Fields inherited from interface hudson.model.Saveable |
---|
NOOP |
Constructor Summary | |
---|---|
protected |
AbstractBuild(P job)
|
protected |
AbstractBuild(P job,
Calendar timestamp)
|
protected |
AbstractBuild(P project,
File buildDir)
|
Method Summary | |
---|---|
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() |
Calendar |
due()
|
AggregatedTestResultAction |
getAggregatedTestResultAction()
Gets AggregatedTestResultAction associated with this build if any. |
Collection<Fingerprint> |
getBuildFingerprints()
get the fingerprints associated with this build |
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 slave it was built on; null or "" if built by the master. |
ChangeLogSet<? extends ChangeLogSet.Entry> |
getChangeSet()
Gets the changes incorporated into this build. |
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. |
Set<String> |
getSensitiveBuildVariables()
Builds up a set of variable names that contain sensitive values that should not be exposed. |
AbstractTestResultAction |
getTestResultAction()
Gets AbstractTestResultAction associated with this build if any. |
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. |
boolean |
hasParticipant(User user)
Returns true if this user has made a commit to this build. |
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 RunExecution , but this lets you set the workspace in case
AbstractBuild is created without a build. |
Methods inherited from class hudson.model.Actionable |
---|
doContextMenu, getAction, getAction, getActions, getActions |
Methods inherited from class hudson.model.AbstractModelObject |
---|
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface hudson.model.Queue.Executable |
---|
getEstimatedDuration, getParent, toString |
Field Detail |
---|
protected transient List<Environment> buildEnvironments
BuildWrapper.Environment
s created by
BuildWrapper
. This design is bit ugly but forced due to compatibility.
Constructor Detail |
---|
protected AbstractBuild(P job) throws IOException
IOException
protected AbstractBuild(P job, Calendar timestamp)
protected AbstractBuild(P project, File buildDir) throws IOException
IOException
Method Detail |
---|
public final P getProject()
public R getPreviousBuild()
getPreviousBuild
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public R getNextBuild()
getNextBuild
in class Run<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
@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(FilePath ws)
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.
@Exported public Set<User> getCulprits()
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.
public boolean hasParticipant(User user)
public String getHudsonVersion()
@Exported(name="fingerprint", inline=true, visibility=-1) public Collection<Fingerprint> getBuildFingerprints()
@Exported public ChangeLogSet<? extends ChangeLogSet.Entry> getChangeSet()
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>>
null
.
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 List<Action> getPersistentActions()
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()
.
public AbstractTestResultAction getTestResultAction()
AbstractTestResultAction
associated with this build if any.
public AggregatedTestResultAction getAggregatedTestResultAction()
AggregatedTestResultAction
associated with this build if any.
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
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |