public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>> extends Job<P,R> implements BuildableItem, LazyBuildMixIn.LazyLoadingJob<P,R>, ParameterizedJobMixIn.ParameterizedJob
Job
s that build software.
For now this is primarily the common part of Project
and MavenModule.AbstractBuild
Modifier and Type | Class and Description |
---|---|
static class |
AbstractProject.AbstractProjectDescriptor
AbstractProject subtypes should implement this base class as a descriptor. |
static class |
AbstractProject.BecauseOfBuildInProgress
Deprecated.
use
BlockedBecauseOfBuildInProgress instead. |
static class |
AbstractProject.BecauseOfDownstreamBuildInProgress
Because the downstream build is in progress, and we are configured to wait for that.
|
static class |
AbstractProject.BecauseOfUpstreamBuildInProgress
Because the upstream build is in progress, and we are configured to wait for that.
|
static class |
AbstractProject.LabelValidator
Plugins may want to contribute additional restrictions on the use of specific labels for specific projects.
|
Job.LastItemListener
ExtensionPoint.LegacyInstancesAreScopedToHudson
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
Modifier and Type | Field and Description |
---|---|
static Permission |
ABORT
Deprecated.
Just use
Item.CANCEL . |
protected boolean |
blockBuildWhenDownstreamBuilding
True to keep builds of this project in queue when downstream projects are
building.
|
protected boolean |
blockBuildWhenUpstreamBuilding
True to keep builds of this project in queue when upstream projects are
building.
|
static AlternativeUiTextProvider.Message<AbstractProject> |
BUILD_NOW_TEXT
Deprecated.
|
protected RunMap<R> |
builds
All the builds keyed by their build number.
|
protected boolean |
disabled
True to suspend new builds.
|
protected List<Action> |
transientActions
Action s contributed from subsidiary objects associated with
AbstractProject , such as from triggers, builders, publishers, etc. |
protected DescribableList<Trigger<?>,TriggerDescriptor> |
triggers
List of all
Trigger s for this project. |
HISTORY_ADAPTER, nextBuildNumber, properties, runIdMigrator
description, displayName, name, PRONOUN
Modifier | Constructor and Description |
---|---|
protected |
AbstractProject(ItemGroup parent,
String name) |
Modifier and Type | Method and Description |
---|---|
RunMap<R> |
_getRuns()
Gets all the runs.
|
void |
addProperty(JobProperty<? super P> jobProp)
Adds
JobProperty . |
protected <T extends Describable<T>> |
addToList(T item,
List<T> collection) |
void |
addTrigger(Trigger<?> trigger)
|
boolean |
blockBuildWhenDownstreamBuilding() |
boolean |
blockBuildWhenUpstreamBuilding() |
protected void |
buildDependencyGraph(DependencyGraph graph)
Builds the dependency graph.
|
protected <T extends Describable<T>> |
buildDescribable(org.kohsuke.stapler.StaplerRequest req,
List<? extends Descriptor<T>> descriptors) |
protected <T extends Describable<T>> |
buildDescribable(org.kohsuke.stapler.StaplerRequest req,
List<? extends Descriptor<T>> descriptors,
String prefix)
Deprecated.
As of 1.261. Use
buildDescribable(StaplerRequest, List) instead. |
void |
checkAbortPermission()
Checks the permission to see if the current user can abort this executable.
|
boolean |
checkout(AbstractBuild build,
Launcher launcher,
BuildListener listener,
File changelogFile) |
R |
createExecutable()
Creates
Queue.Executable , which performs the actual execution of the task. |
protected HistoryWidget |
createHistoryWidget() |
protected List<Action> |
createTransientActions() |
void |
disable() |
void |
doBuild(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Deprecated.
|
void |
doBuild(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
TimeDuration delay)
Schedules a new build command.
|
void |
doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
void |
doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
TimeDuration delay)
Supports build trigger with parameters via an HTTP GET or POST.
|
void |
doCancelQueue(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Cancels a scheduled build.
|
FormValidation |
doCheckRetryCount(String value)
Validates the retry count Regex
|
void |
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts submission from the configuration page.
|
org.kohsuke.stapler.HttpResponse |
doDisable() |
org.kohsuke.stapler.HttpResponse |
doDoWipeOutWorkspace()
Wipes out the workspace.
|
org.kohsuke.stapler.HttpResponse |
doEnable() |
void |
doPolling(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Schedules a new SCM polling command.
|
void |
doRssChangelog(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
RSS feed for changes in this project.
|
DirectoryBrowserSupport |
doWs(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Serves the workspace files.
|
void |
enable() |
static AbstractProject |
findNearest(String name)
Finds a
AbstractProject that has the name closest to the given name. |
static AbstractProject |
findNearest(String name,
ItemGroup context)
Finds a
AbstractProject whose name (when referenced from the specified context) is closest to the given name. |
List<Action> |
getActions()
Gets actions contributed to this object.
|
Label |
getAssignedLabel()
If this project is configured to be always built on this node,
return that
Node . |
String |
getAssignedLabelString()
Gets the textual representation of the assigned label as it was entered by the user.
|
BuildAuthorizationToken |
getAuthToken() |
R |
getBuild(String id)
Looks up a build by its ID.
|
R |
getBuildByNumber(int n)
More efficient implementation.
|
protected abstract Class<R> |
getBuildClass()
Type token for the corresponding build type.
|
AbstractProject |
getBuildingDownstream()
Returns the project if any of the downstream project is either
building, waiting, pending or buildable.
|
AbstractProject |
getBuildingUpstream()
Returns the project if any of the upstream project is either
building or is in the queue.
|
String |
getBuildNowText()
Gets the human readable display name to be rendered in the "Build Now" link.
|
List<AbstractProject> |
getBuildTriggerUpstreamProjects()
Returns only those upstream projects that defines
BuildTrigger to this project. |
CauseOfBlockage |
getCauseOfBlockage()
If the execution of this task should be blocked for temporary reasons,
this method returns a non-null object explaining why.
|
String |
getCustomWorkspace() |
org.acegisecurity.Authentication |
getDefaultAuthentication()
This method allows the task to provide the default fallback authentication object to be used
when
QueueItemAuthenticator fails to authenticate the build. |
org.acegisecurity.Authentication |
getDefaultAuthentication(Queue.Item item)
This method allows the task to provide the default fallback authentication object to be used
when
QueueItemAuthenticator fails to authenticate the build. |
int |
getDelay(org.kohsuke.stapler.StaplerRequest req)
Deprecated.
as of 1.489
Inject
TimeDuration . |
List<AbstractProject> |
getDownstreamProjects()
Gets the other
AbstractProject s that should be built
when a build of this project is completed. |
EnvVars |
getEnvironment(Node node,
TaskListener listener)
Creates an environment variable override for launching processes for this project.
|
R |
getFirstBuild()
Returns the oldest build in the record.
|
boolean |
getHasCustomQuietPeriod() |
BallColor |
getIconColor()
Used as the color of the status ball for the project.
|
JDK |
getJDK()
Gets the JDK that this project is configured with, or null.
|
R |
getLastBuild()
Returns the last build.
|
Node |
getLastBuiltOn()
Gets the
Node where this project was last built on. |
LazyBuildMixIn<P,R> |
getLazyBuildMixIn() |
FilePath |
getModuleRoot()
Deprecated.
as of 1.319
See
getWorkspace() for a migration strategy. |
FilePath[] |
getModuleRoots()
Deprecated.
as of 1.319
See
getWorkspace() for a migration strategy. |
R |
getNearestBuild(int n)
Gets the youngest build #m that satisfies n<=m.
|
R |
getNearestOldBuild(int n)
Gets the latest build #m that satisfies m<=n.
|
Queue.Task |
getOwnerTask()
Gets the
Queue.Task that this subtask belongs to. |
List<ProminentProjectAction> |
getProminentActions() |
String |
getPronoun()
Get the term used in the UI to represent this kind of
AbstractProject . |
abstract DescribableList<Publisher,Descriptor<Publisher>> |
getPublishersList()
Returns the live list of all
Publisher s configured for this project. |
Queue.Item |
getQueueItem()
If this job is in the build queue, return its item.
|
int |
getQuietPeriod() |
SortedMap<Integer,Fingerprint.RangeSet> |
getRelationship(AbstractProject that)
Gets the dependency relationship map between this project (as the source)
and that project (as the sink.)
|
Set<Label> |
getRelevantLabels()
Set of labels relevant to this job.
|
protected Set<ResourceActivity> |
getResourceActivities()
Set of child resource activities of the build of this project (override in child projects).
|
ResourceList |
getResourceList()
List of necessary resources to perform the build of this project.
|
AbstractProject<?,?> |
getRootProject()
Gets the nearest ancestor
TopLevelItem that's also an AbstractProject . |
Object |
getSameNodeConstraint()
If a subset of
SubTask s of a Queue.Task needs to be collocated with other SubTask s,
those SubTask s should return the equal object here. |
SCM |
getScm() |
int |
getScmCheckoutRetryCount() |
SCMCheckoutStrategy |
getScmCheckoutStrategy() |
R |
getSomeBuildWithWorkspace()
Gets some build that has a live workspace.
|
FilePath |
getSomeWorkspace()
Gets a workspace for some build of this project.
|
List<SubTask> |
getSubTasks()
Obtains the
SubTask s that constitute this task. |
Set<AbstractProject> |
getTransitiveDownstreamProjects()
Gets all the downstream projects including transitive downstream projects.
|
Set<AbstractProject> |
getTransitiveUpstreamProjects()
Gets all the upstream projects including transitive upstream projects.
|
<T extends Trigger> |
getTrigger(Class<T> clazz)
Gets the specific trigger, or null if the propert is not configured for this job.
|
Map<TriggerDescriptor,Trigger<?>> |
getTriggers()
Gets currently configured triggers.
|
List<AbstractProject> |
getUpstreamProjects() |
String |
getWhyBlocked() |
FilePath |
getWorkspace()
Deprecated.
as of 1.319
To support concurrent builds of the same project, this method is moved to
AbstractBuild .
For backward compatibility, this method returns the right AbstractBuild.getWorkspace() if called
from Executor , and otherwise the workspace of the last build.
If you are calling this method during a build from an executor, switch it to |
Resource |
getWorkspaceResource()
Deprecated.
as of 1.319
Projects no longer have a fixed workspace, ands builds will find an available workspace via
WorkspaceList for each build (furthermore, that happens after a build is started.)
So a Resource representation for a workspace at the project level no longer makes sense.
If you need to lock a workspace while you do some computation, see the source code of
|
boolean |
hasAbortPermission()
Works just like
Queue.Task.checkAbortPermission() except it indicates the status by a return value,
instead of exception. |
boolean |
hasCustomScmCheckoutRetryCount() |
boolean |
hasParticipant(User user)
Returns true if this user has made a commit to this project.
|
boolean |
isBuildable()
Returns true if we should display "build now" icon
|
boolean |
isBuildBlocked()
Returns true if the execution should be blocked
for temporary reasons.
|
boolean |
isConcurrentBuild()
Does this project perform concurrent builds?
|
boolean |
isConfigurable()
Used in sidepanel.jelly to decide whether to display
the config/delete/build links.
|
boolean |
isDisabled() |
abstract boolean |
isFingerprintConfigured()
True if the builds of this project produces
Fingerprint records. |
boolean |
isInQueue()
Returns true if the build is in the queue.
|
boolean |
isParameterized() |
protected R |
loadBuild(File dir)
Loads an existing build record from disk.
|
void |
makeDisabled(boolean b)
Marks the build as disabled.
|
protected SearchIndexBuilder |
makeSearchIndex()
Default implementation that returns empty index.
|
protected R |
newBuild()
Creates a new build of this project for immediate execution.
|
void |
onCreatedFromScratch()
When an item is created from scratch (instead of copied),
this method will be invoked.
|
void |
onLoad(ItemGroup<? extends Item> parent,
String name)
Called right after when a
Item is loaded from disk. |
protected void |
performDelete()
Does the real job of deleting the item.
|
PollingResult |
poll(TaskListener listener)
Checks if there's any update in SCM, and returns true if any is found.
|
boolean |
pollSCMChanges(TaskListener listener)
Deprecated.
as of 1.346
Use
poll(TaskListener) instead. |
protected <T extends Describable<T>> |
removeFromList(Descriptor<T> item,
List<T> collection) |
void |
removeRun(R run)
Called from
Run to remove it from this job. |
void |
removeTrigger(TriggerDescriptor trigger) |
static AbstractProject |
resolveForCLI(String name)
Used for CLI binding.
|
void |
save()
Save the settings to a file.
|
boolean |
scheduleBuild()
Deprecated.
Use
scheduleBuild(Cause) . Since 1.283 |
boolean |
scheduleBuild(Cause c)
Schedules a build of this project.
|
boolean |
scheduleBuild(int quietPeriod)
Deprecated.
Use
scheduleBuild(int, Cause) . Since 1.283 |
boolean |
scheduleBuild(int quietPeriod,
Cause c) |
boolean |
scheduleBuild(int quietPeriod,
Cause c,
Action... actions)
Schedules a build.
|
QueueTaskFuture<R> |
scheduleBuild2(int quietPeriod)
Schedules a build, and returns a
Future object
to wait for the completion of the build. |
QueueTaskFuture<R> |
scheduleBuild2(int quietPeriod,
Cause c)
Schedules a build of this project, and returns a
Future object
to wait for the completion of the build. |
QueueTaskFuture<R> |
scheduleBuild2(int quietPeriod,
Cause c,
Action... actions)
Schedules a build of this project, and returns a
Future object
to wait for the completion of the build. |
QueueTaskFuture<R> |
scheduleBuild2(int quietPeriod,
Cause c,
Collection<? extends Action> actions)
Schedules a build of this project, and returns a
Future object
to wait for the completion of the build. |
boolean |
schedulePolling()
Schedules a polling of this project.
|
void |
setAssignedLabel(Label l)
Sets the assigned label.
|
void |
setAssignedNode(Node l)
Assigns this job to the given node.
|
void |
setBlockBuildWhenDownstreamBuilding(boolean b) |
void |
setBlockBuildWhenUpstreamBuilding(boolean b) |
void |
setConcurrentBuild(boolean b) |
void |
setCustomWorkspace(String customWorkspace)
User-specified workspace directory, or null if it's up to Jenkins.
|
void |
setJDK(JDK jdk)
Overwrites the JDK setting.
|
void |
setQuietPeriod(Integer seconds)
Sets the custom quiet period of this project, or revert to the global default if null is given.
|
void |
setScm(SCM scm) |
void |
setScmCheckoutStrategy(SCMCheckoutStrategy scmCheckoutStrategy) |
protected void |
submit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Derived class can override this to perform additional config submission
work.
|
boolean |
supportsMakeDisabled()
Specifies whether this project may be disabled by the user.
|
protected DescribableList<Trigger<?>,TriggerDescriptor> |
triggers() |
protected void |
updateTransientActions()
effectively deprecated.
|
assignBuildNumber, delete, doBuildStatus, doChildrenContextMenu, doDescription, doDoRename, doRssAll, doRssFailed, getACL, getAllJobs, getAllProperties, getBuildDir, getBuildDiscarder, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusIconClassName, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, getEstimatedDuration, getEstimatedDurationCandidates, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getLogRotator, getNewBuilds, getNextBuildNumber, getOverrides, getPermalinks, getProperties, getProperty, getProperty, getTimeline, getWidgets, isBuilding, isHoldOffBuildUntilSave, isKeepDependencies, isLogUpdated, isNameEditable, logRotate, movedTo, onCopiedFrom, removeProperty, removeProperty, renameTo, saveNextBuildNumber, setBuildDiscarder, setLogRotator, supportsLogRotator, updateNextBuildNumber
checkPermission, delete, doConfigDotXml, doDoDelete, doReload, doSetName, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getRelativeDisplayNameFrom, getRelativeNameFrom, getRelativeNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getUrl, hasPermission, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml
addAction, doContextMenu, getAction, getAction, getActions, getAllActions, replaceAction
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFullDisplayName, getName, getUrl
getEstimatedDuration
getDisplayName
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCopiedFrom
getRootDir
getSearch
getSearchIndex, getSearchName, getSearchUrl
checkPermission, getACL, hasPermission
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) protected transient RunMap<R extends AbstractBuild<P,R>> builds
buildMixIn
.
External code should use getBuildByNumber(int)
or getLastBuild()
and traverse via
Run.getPreviousBuild()
protected volatile boolean disabled
protected volatile boolean blockBuildWhenDownstreamBuilding
protected volatile boolean blockBuildWhenUpstreamBuilding
protected volatile DescribableList<Trigger<?>,TriggerDescriptor> triggers
Trigger
s for this project.@CopyOnWrite protected transient volatile List<Action> transientActions
Action
s contributed from subsidiary objects associated with
AbstractProject
, such as from triggers, builders, publishers, etc.
We don't want to persist them separately, and these actions
come and go as configuration change, so it's kept separate.@Deprecated public static final Permission ABORT
Item.CANCEL
.@Deprecated public static final AlternativeUiTextProvider.Message<AbstractProject> BUILD_NOW_TEXT
ParameterizedJobMixIn.BUILD_NOW_TEXT
.public LazyBuildMixIn<P,R> getLazyBuildMixIn()
getLazyBuildMixIn
in interface LazyBuildMixIn.LazyLoadingJob<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public void save() throws IOException
AbstractItem
save
in interface Item
save
in interface Saveable
save
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
- if the persistence failed.public void onCreatedFromScratch()
Item
onCreatedFromScratch
in interface Item
onCreatedFromScratch
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException
AbstractItem
Item
is loaded from disk.
This is an opportunity to do a post load processing.onLoad
in interface Item
onLoad
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
name
- Name of the directory (not a path --- just the name portion) from
which the configuration was loaded. This usually becomes the
name
of this item.IOException
@WithBridgeMethods(value=java.util.List.class) protected DescribableList<Trigger<?>,TriggerDescriptor> triggers()
public EnvVars getEnvironment(Node node, TaskListener listener) throws IOException, InterruptedException
Job
This is for process launching outside the build execution (such as polling, tagging, deployment, etc.) that happens in a context of a specific job.
getEnvironment
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
node
- Node to eventually run a process on. The implementation must cope with this parameter being null
(in which case none of the node specific properties would be reflected in the resulting override.)IOException
InterruptedException
protected void performDelete() throws IOException, InterruptedException
AbstractItem
performDelete
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
InterruptedException
@Exported public boolean isConcurrentBuild()
isConcurrentBuild
in interface Queue.Task
public void setConcurrentBuild(boolean b) throws IOException
IOException
@CheckForNull public Label getAssignedLabel()
Node
. Otherwise null.getAssignedLabel
in interface SubTask
public Set<Label> getRelevantLabels()
View
s.
It does not affect the scheduling. This information is informational and the best-effort basis.getAssignedLabel()
. The set can contain null element
to correspond to the null return value from getAssignedLabel()
.public String getAssignedLabelString()
public void setAssignedLabel(Label l) throws IOException
IOException
public void setAssignedNode(Node l) throws IOException
setAssignedLabel(Label)
.IOException
public String getPronoun()
AbstractProject
.
Must start with a capital letter.getPronoun
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public String getBuildNowText()
getBuildNowText
in interface ParameterizedJobMixIn.ParameterizedJob
public AbstractProject<?,?> getRootProject()
TopLevelItem
that's also an AbstractProject
.
Some projects (such as matrix projects, Maven projects, or promotion processes) form a tree of jobs that acts as a single unit. This method can be used to find the top most dominating job that covers such a tree.
AbstractBuild.getRootBuild()
@Deprecated public final FilePath getWorkspace()
AbstractBuild
.
For backward compatibility, this method returns the right AbstractBuild.getWorkspace()
if called
from Executor
, and otherwise the workspace of the last build.
If you are calling this method during a build from an executor, switch it to AbstractBuild.getWorkspace()
.
If you are calling this method to serve a file from the workspace, doing a form validation, etc., then
use getSomeWorkspace()
@CheckForNull public final FilePath getSomeWorkspace()
This is useful for obtaining a workspace for the purpose of form field validation, where exactly which build the workspace belonged is less important. The implementation makes a cursory effort to find some workspace.
public final R getSomeBuildWithWorkspace()
@Deprecated public FilePath getModuleRoot()
getWorkspace()
for a migration strategy.This is usually where pom.xml, build.xml and so on exists.
@Deprecated public FilePath[] getModuleRoots()
getWorkspace()
for a migration strategy.Some SCMs support checking out multiple modules into the same workspace. In these cases, the returned array will have a length greater than one.
public int getQuietPeriod()
getQuietPeriod
in interface ParameterizedJobMixIn.ParameterizedJob
public SCMCheckoutStrategy getScmCheckoutStrategy()
public void setScmCheckoutStrategy(SCMCheckoutStrategy scmCheckoutStrategy) throws IOException
IOException
public int getScmCheckoutRetryCount()
public boolean getHasCustomQuietPeriod()
public void setQuietPeriod(Integer seconds) throws IOException
IOException
public boolean hasCustomScmCheckoutRetryCount()
public boolean isBuildable()
Job
isBuildable
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public boolean isConfigurable()
public boolean blockBuildWhenDownstreamBuilding()
public void setBlockBuildWhenDownstreamBuilding(boolean b) throws IOException
IOException
public boolean blockBuildWhenUpstreamBuilding()
public void setBlockBuildWhenUpstreamBuilding(boolean b) throws IOException
IOException
public boolean isDisabled()
public FormValidation doCheckRetryCount(@QueryParameter String value) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void makeDisabled(boolean b) throws IOException
supportsMakeDisabled()
returns false. The enable command will be executed in any case.b
- true - disable, false - enableIOException
supportsMakeDisabled()
returns falsepublic boolean supportsMakeDisabled()
TopLevelItem
;
would be false for matrix configurations, etc.doDisable()
and the likepublic void disable() throws IOException
IOException
public void enable() throws IOException
IOException
public BallColor getIconColor()
Job
getIconColor
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
protected void updateTransientActions()
Override createTransientActions()
instead.
public abstract DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
Publisher
s configured for this project.
This method couldn't be called getPublishers() because existing methods in sub-classes return different inconsistent types.
public void addProperty(JobProperty<? super P> jobProp) throws IOException
Job
JobProperty
.addProperty
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
public List<ProminentProjectAction> getProminentActions()
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
Job
doConfigSubmit
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
javax.servlet.ServletException
Descriptor.FormException
@Deprecated public boolean scheduleBuild()
scheduleBuild(Cause)
. Since 1.283scheduleBuild
in interface BuildableItem
@Deprecated public boolean scheduleBuild(int quietPeriod)
scheduleBuild(int, Cause)
. Since 1.283scheduleBuild
in interface BuildableItem
public boolean scheduleBuild(Cause c)
scheduleBuild
in interface BuildableItem
public boolean scheduleBuild(int quietPeriod, Cause c)
scheduleBuild
in interface BuildableItem
public boolean scheduleBuild(int quietPeriod, Cause c, Action... actions)
quietPeriod
- the quiet period to observerc
- the cause for this build which should be recordedactions
- a list of Actions that will be added to the build@WithBridgeMethods(value=java.util.concurrent.Future.class) public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c, Action... actions)
Future
object
to wait for the completion of the build.actions
- For the convenience of the caller, this array can contain null, and those will be silently ignored.@WithBridgeMethods(value=java.util.concurrent.Future.class) public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
Future
object
to wait for the completion of the build.actions
- For the convenience of the caller, this collection can contain null, and those will be silently ignored.@WithBridgeMethods(value=java.util.concurrent.Future.class) public QueueTaskFuture<R> scheduleBuild2(int quietPeriod)
Future
object
to wait for the completion of the build.
Production code shouldn't be using this, but for tests this is very convenient, so this isn't marked as deprecated.
@WithBridgeMethods(value=java.util.concurrent.Future.class) public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c)
Future
object
to wait for the completion of the build.public boolean schedulePolling()
public boolean isInQueue()
isInQueue
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public Queue.Item getQueueItem()
Job
getQueueItem
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public JDK getJDK()
public void setJDK(JDK jdk) throws IOException
IOException
public BuildAuthorizationToken getAuthToken()
getAuthToken
in interface ParameterizedJobMixIn.ParameterizedJob
public RunMap<R> _getRuns()
Job
_getRuns
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn._getRuns()
public void removeRun(R run)
Job
Run
to remove it from this job.
The files are deleted already. So all the callee needs to do is to remove
a reference from this Job
.removeRun
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.removeRun(RunT)
public R getBuild(String id)
getBuild
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.getBuild(java.lang.String)
public R getBuildByNumber(int n)
getBuildByNumber
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
n
- The build number.Run.getNumber()
,
LazyBuildMixIn.getBuildByNumber(int)
public R getFirstBuild()
getFirstBuild
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.getFirstBuild()
@CheckForNull public R getLastBuild()
Job
getLastBuild
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.getLastBuild()
public R getNearestBuild(int n)
Job
getNearestBuild
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.getNearestBuild(int)
public R getNearestOldBuild(int n)
Job
getNearestOldBuild
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.getNearestOldBuild(int)
protected abstract Class<R> getBuildClass()
File
.protected R newBuild() throws IOException
IOException
protected R loadBuild(File dir) throws IOException
IOException
public List<Action> getActions()
A new Action
can be added by Actionable.addAction(hudson.model.Action)
.
If you are reading the list, rather than modifying it,
use Actionable.getAllActions()
instead.
This method by default returns only persistent actions
(though some subclasses override it to return an extended unmodifiable list).
Note that this method returns a read-only view of Action
s.
BuildStep
s and others who want to add a project action
should do so by implementing BuildStep.getProjectActions(AbstractProject)
.
getActions
in class Actionable
TransientProjectActionFactory
public Node getLastBuiltOn()
Node
where this project was last built on.getLastBuiltOn
in interface SubTask
public Object getSameNodeConstraint()
SubTask
SubTask
s of a Queue.Task
needs to be collocated with other SubTask
s,
those SubTask
s should return the equal object here. If null, the execution unit isn't under a
colocation constraint.getSameNodeConstraint
in interface SubTask
public final Queue.Task getOwnerTask()
SubTask
Queue.Task
that this subtask belongs to.getOwnerTask
in interface SubTask
@Nonnull public org.acegisecurity.Authentication getDefaultAuthentication()
Queue.Task
QueueItemAuthenticator
fails to authenticate the build.
When the task execution touches other objects inside Jenkins, the access control is performed
based on whether this Authentication
is allowed to use them.
This method was added to an interface after it was created, so plugins built against
older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on Tasks
to avoid AbstractMethodError
.
getDefaultAuthentication
in interface Queue.Task
QueueItemAuthenticator
,
Tasks.getDefaultAuthenticationOf(Queue.Task)
@Nonnull public org.acegisecurity.Authentication getDefaultAuthentication(Queue.Item item)
Queue.Task
QueueItemAuthenticator
fails to authenticate the build.
When the task execution touches other objects inside Jenkins, the access control is performed
based on whether this Authentication
is allowed to use them.
This method was added to an interface after it was created, so plugins built against
older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on Tasks
to avoid AbstractMethodError
.
getDefaultAuthentication
in interface Queue.Task
QueueItemAuthenticator
,
Tasks.getDefaultAuthenticationOf(Queue.Task, Queue.Item)
public boolean isBuildBlocked()
Short-hand for getCauseOfBlockage()!=null
.
A project must be blocked if its own previous build is in progress, or if the blockBuildWhenUpstreamBuilding option is true and an upstream project is building, but derived classes can also check other conditions.
isBuildBlocked
in interface Queue.Task
public String getWhyBlocked()
getWhyBlocked
in interface Queue.Task
public CauseOfBlockage getCauseOfBlockage()
Queue.Task
Otherwise this method returns null, indicating that the build can proceed right away.
This can be used to define mutual exclusion that goes beyond
ResourceActivity.getResourceList()
.
getCauseOfBlockage
in interface Queue.Task
public AbstractProject getBuildingDownstream()
This means eventually there will be an automatic triggering of the given project (provided that all builds went smoothly.)
public AbstractProject getBuildingUpstream()
This means eventually there will be an automatic triggering of the given project (provided that all builds went smoothly.)
public List<SubTask> getSubTasks()
Queue.Task
SubTask
s that constitute this task.
The collection returned by this method must also contain the primary SubTask
represented by this Queue.Task
object itself as the first element.
The returned value is read-only.
At least size 1.
Since this is a newly added method, the invocation may results in AbstractMethodError
.
Use Tasks.getSubTasksOf(Queue.Task)
that avoids this.
getSubTasks
in interface Queue.Task
@CheckForNull public R createExecutable() throws IOException
SubTask
Queue.Executable
, which performs the actual execution of the task.createExecutable
in interface SubTask
Queue.Executable
to be launched or null if the executable cannot be
created (e.g. AbstractProject
is disabled)IOException
- Queue.Executable
cannot be createdpublic void checkAbortPermission()
Queue.Task
checkAbortPermission
in interface Queue.Task
public boolean hasAbortPermission()
Queue.Task
Queue.Task.checkAbortPermission()
except it indicates the status by a return value,
instead of exception.
Also used by default for Queue.Item.hasCancelPermission()
.hasAbortPermission
in interface Queue.Task
@Deprecated public Resource getWorkspaceResource()
WorkspaceList
for each build (furthermore, that happens after a build is started.)
So a Resource
representation for a workspace at the project level no longer makes sense.
If you need to lock a workspace while you do some computation, see the source code of
pollSCMChanges(TaskListener)
for how to obtain a lock of a workspace through WorkspaceList
.
Resource
that represents the workspace of this project.
Useful for locking and mutual exclusion control.public ResourceList getResourceList()
getResourceList
in interface ResourceActivity
protected Set<ResourceActivity> getResourceActivities()
public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile) throws IOException, InterruptedException
IOException
InterruptedException
@Deprecated public boolean pollSCMChanges(TaskListener listener)
poll(TaskListener)
instead.public PollingResult poll(TaskListener listener)
The implementation is responsible for ensuring mutual exclusion between polling and builds if necessary.
public boolean hasParticipant(User user)
@Exported public SCM getScm()
public void setScm(SCM scm) throws IOException
IOException
public void addTrigger(Trigger<?> trigger) throws IOException
IOException
public void removeTrigger(TriggerDescriptor trigger) throws IOException
IOException
protected final <T extends Describable<T>> void addToList(T item, List<T> collection) throws IOException
IOException
protected final <T extends Describable<T>> void removeFromList(Descriptor<T> item, List<T> collection) throws IOException
IOException
public Map<TriggerDescriptor,Trigger<?>> getTriggers()
ParameterizedJobMixIn.ParameterizedJob
<p:config-trigger/>
to configure them.getTriggers
in interface ParameterizedJobMixIn.ParameterizedJob
ParameterizedJobMixIn.getTrigger(hudson.model.Job<?, ?>, java.lang.Class<T>)
public <T extends Trigger> T getTrigger(Class<T> clazz)
public abstract boolean isFingerprintConfigured()
Fingerprint
records.@Exported public final List<AbstractProject> getDownstreamProjects()
AbstractProject
s that should be built
when a build of this project is completed.@Exported public final List<AbstractProject> getUpstreamProjects()
public final List<AbstractProject> getBuildTriggerUpstreamProjects()
BuildTrigger
to this project.
This is a subset of getUpstreamProjects()
No longer used in the UI.
BuildTrigger
to this project.public final Set<AbstractProject> getTransitiveUpstreamProjects()
public final Set<AbstractProject> getTransitiveDownstreamProjects()
public SortedMap<Integer,Fingerprint.RangeSet> getRelationship(AbstractProject that)
protected void buildDependencyGraph(DependencyGraph graph)
triggers()
.protected SearchIndexBuilder makeSearchIndex()
AbstractModelObject
makeSearchIndex
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
protected HistoryWidget createHistoryWidget()
createHistoryWidget
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
LazyBuildMixIn.createHistoryWidget()
public boolean isParameterized()
public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@Deprecated public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
doBuild(StaplerRequest, StaplerResponse, TimeDuration)
IOException
javax.servlet.ServletException
@Deprecated public int getDelay(org.kohsuke.stapler.StaplerRequest req) throws javax.servlet.ServletException
TimeDuration
.javax.servlet.ServletException
public void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@Deprecated public void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doPolling(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doCancelQueue(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
Job
submit
in class Job<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
IOException
javax.servlet.ServletException
Descriptor.FormException
@Deprecated protected final <T extends Describable<T>> List<T> buildDescribable(org.kohsuke.stapler.StaplerRequest req, List<? extends Descriptor<T>> descriptors, String prefix) throws Descriptor.FormException, javax.servlet.ServletException
buildDescribable(StaplerRequest, List)
instead.Descriptor.FormException
javax.servlet.ServletException
protected final <T extends Describable<T>> List<T> buildDescribable(org.kohsuke.stapler.StaplerRequest req, List<? extends Descriptor<T>> descriptors) throws Descriptor.FormException, javax.servlet.ServletException
Descriptor.FormException
javax.servlet.ServletException
public DirectoryBrowserSupport doWs(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, InterruptedException
IOException
javax.servlet.ServletException
InterruptedException
public org.kohsuke.stapler.HttpResponse doDoWipeOutWorkspace() throws IOException, javax.servlet.ServletException, InterruptedException
IOException
javax.servlet.ServletException
InterruptedException
@CLIMethod(name="disable-job") public org.kohsuke.stapler.HttpResponse doDisable() throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@CLIMethod(name="enable-job") public org.kohsuke.stapler.HttpResponse doEnable() throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssChangelog(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@CheckForNull public static AbstractProject findNearest(String name)
AbstractProject
that has the name closest to the given name.@CheckForNull public static AbstractProject findNearest(String name, ItemGroup context)
AbstractProject
whose name (when referenced from the specified context) is closest to the given name.Items.findNearest(java.lang.Class<T>, java.lang.String, hudson.model.ItemGroup)
@CLIResolver public static AbstractProject resolveForCLI(String name) throws org.kohsuke.args4j.CmdLineException
org.kohsuke.args4j.CmdLineException
public String getCustomWorkspace()
public void setCustomWorkspace(String customWorkspace) throws IOException
Normally a project uses the workspace location assigned by its parent container, but sometimes people have builds that have hard-coded paths.
This is not File
because it may have to hold a path representation on another OS.
If this path is relative, it's resolved against Node.getRootPath()
on the node where this workspace
is prepared.
IOException
Copyright © 2015. All rights reserved.