Class InheritanceProject
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.Actionable
-
- hudson.model.AbstractItem
-
- hudson.model.Job<P,R>
-
- hudson.model.AbstractProject<P,B>
-
- hudson.model.Project<InheritanceProject,InheritanceBuild>
-
- hudson.plugins.project_inheritance.projects.InheritanceProject
-
- All Implemented Interfaces:
ExtensionPoint
,BuildableItem
,BuildableItemWithBuildWrappers
,Describable<TopLevelItem>
,DescriptorByNameOwner
,Item
,ModelObject
,PersistenceRoot
,SubTask
,Queue.Task
,ResourceActivity
,Saveable
,TopLevelItem
,SVGNode
,SearchableModelObject
,SearchItem
,AccessControlled
,Maven.ProjectWithMaven
,Comparable<Project>
,LazyBuildMixIn.LazyLoadingJob<InheritanceProject,InheritanceBuild>
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,ParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
,SCMTriggerItem
,OnMaster
,org.kohsuke.stapler.HttpDeletable
,org.kohsuke.stapler.StaplerOverridable
,org.kohsuke.stapler.StaplerProxy
public class InheritanceProject extends Project<InheritanceProject,InheritanceBuild> implements TopLevelItem, Comparable<Project>, SVGNode
A simple base class for all inheritable jobs/projects. TODO: Create suitable JavaDoc description for this class- Author:
- Martin Schroeder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InheritanceProject.Dependency
static class
InheritanceProject.DescriptorImpl
static class
InheritanceProject.IMode
static class
InheritanceProject.InheritedVersionInfo
class
InheritanceProject.ParameterDerivationDetails
static class
InheritanceProject.Relationship
A very simple enum for the possible relationship states between to projects.-
Nested classes/interfaces inherited from class hudson.model.AbstractProject
AbstractProject.AbstractProjectDescriptor, AbstractProject.BecauseOfBuildInProgress, AbstractProject.BecauseOfDownstreamBuildInProgress, AbstractProject.BecauseOfUpstreamBuildInProgress, AbstractProject.LabelValidator
-
Nested classes/interfaces inherited from class hudson.model.Job
Job.LastItemListener, Job.SubItemBuildsLocationImpl
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
-
Nested classes/interfaces inherited from interface jenkins.triggers.SCMTriggerItem
SCMTriggerItem.SCMTriggerItems
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedList<AbstractProjectReference>
compatibleProjects
This list stores references to the projects this project was marked as being compatible with.protected String
creationClass
This stores the name of the creation class this project falls in.static InheritanceProject.DescriptorImpl
DESCRIPTOR
boolean
isAbstract
Flag to denote a project that can't be built directly; but contrary to to theisBuildable()
value, additionally means that certain checks for inheritance consistence are relaxed.protected boolean
isTransient
Flag to denote a transient project that is not serialized to disk.protected static TimedBuffer<InheritanceProject,String>
onChangeBuffer
Same asonSelfChangeBuffer
, but this buffer is cleared when any project is changed or loaded anew.protected static TimedBuffer<InheritanceProject,String>
onInheritChangeBuffer
This buffer is used for objects that don't need to be repeatedly generated, as long as the configuration of this project or its parents has not changed.protected static TimedBuffer<InheritanceProject,String>
onSelfChangeBuffer
Same asonSelfChangeBuffer
, but this buffer is cleared only when the project itself is changed.protected String
parameterizedWorkspace
protected LinkedList<AbstractProjectReference>
parentReferences
This list stores the adjacency relationship of this project to its parents.protected String
variance
This field is only valid for transient jobs.static Permission
VERSION_CONFIG
protected VersionedObjectStore
versionStore
ThisVersionedObjectStore
is used to version all configurable properties of this class.-
Fields inherited from class hudson.model.AbstractProject
ABORT, blockBuildWhenDownstreamBuilding, blockBuildWhenUpstreamBuilding, BUILD_NOW_TEXT, builds, disabled, transientActions, triggers
-
Fields inherited from class hudson.model.Job
HISTORY_ADAPTER, nextBuildNumber, properties, runIdMigrator
-
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN
-
-
Constructor Summary
Constructors Constructor Description InheritanceProject(ItemGroup parent, String name, boolean isTransient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addParentReference(AbstractProjectReference ref)
Wrapper aroundaddParentReference(AbstractProjectReference, boolean)
with duplication check enabled.void
addParentReference(AbstractProjectReference ref, boolean duplicateCheck)
Adds the givenProjectReference
as a parent to this node.boolean
blockBuildWhenDownstreamBuilding()
boolean
blockBuildWhenDownstreamBuilding(InheritanceProject.IMode mode)
boolean
blockBuildWhenUpstreamBuilding()
boolean
blockBuildWhenUpstreamBuilding(InheritanceProject.IMode mode)
protected void
buildDependencyGraph(DependencyGraph graph)
This method is called after a save to restructure the dependency graph.static void
clearBuffers(InheritanceProject root)
int
compareTo(Project o)
static void
createBuffers()
static void
createConfigureVersionsPermission()
This blank static initializer method will ensure that the class is loaded on start-up and that the VERSION_CONFIG permission is created.protected List<Action>
createTransientActions()
Overrides the super-function to always return an empty list.protected List<Action>
createVersionAwareTransientActions()
Creates a list of temporaryAction
s as they are contributed by the various Builders, Publishers, etc.void
doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay)
Executes a build started from the GUI.void
doBuildSpecificVersion(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
This method is used, when the user wishes to build a very specific version of this project or its parents.void
doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
String
doComputeVersionDiff(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doConfigDotXml(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Accepts config.xml submission, as well as serve it.void
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doConfigVersionsSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doDoDelete(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
String
doGetConfigAsXML(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
This method displays the configuration as a complete XML dump.String
doGetParamDefaultsAsXML()
This method dumps the default values of all parameters (even derived ones) into an XML file.String
doGetParamExpansionsAsXML()
This method dumps the full expansion of all parameters (even derived ones) based on their default values into an XML file.String
doGetVersionsAsCompressedXML()
This method dumps the version store as serialized, GZIP compressed, Base64 encoded XML.String
doGetVersionsAsXML()
This method dumps the version store as serialized XML.String
doRenderSVGRelationGraph()
void
doSubmitChildJobCreation(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
dumpConfigToNewVersion()
Wrapper arounddumpConfigToNewVersion(String)
with an empty message.void
dumpConfigToNewVersion(String message)
This method takes the current configuration and dumps all relevant fields into the versioning-store.protected void
dumpConfigToVersion(VersionedObjectStore.Version v)
This method implements the actual association of a set of objects with a given version.protected void
filterVersionMap(Map<String,Long> verMap)
This method simplifies the given versioning map, by removing all versions that superfluous.List<Action>
getActions()
List<Action>
getActions(InheritanceProject.IMode mode)
List<InheritanceProject.InheritedVersionInfo>
getAllInheritedVersionsList()
List<InheritanceProject.InheritedVersionInfo>
getAllInheritedVersionsList(InheritanceBuild build)
Returns the versions for all parent projects (including the current one) based on the information in the given build.static List<InheritanceProject.InheritedVersionInfo>
getAllInheritedVersionsList(InheritanceProject root, InheritanceBuild build)
Static part ofgetAllInheritedVersionsList(InheritanceBuild)
.List<AbstractProjectReference>
getAllParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey)
This method returns a list of all parent references.List<AbstractProjectReference>
getAllParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey, boolean addSelf)
Wrapper forgetAllParentReferences(ProjectReference.PrioComparator.SELECTOR)
, but will add a reference to this project too, if needed.List<JobProperty<? super InheritanceProject>>
getAllProperties()
List<JobProperty<? super InheritanceProject>>
getAllProperties(InheritanceProject.IMode mode)
Label
getAssignedLabel()
Label
getAssignedLabel(InheritanceProject.IMode mode)
String
getAssignedLabelString()
CauseAction
getBuildCauseOverride(org.kohsuke.stapler.StaplerRequest req)
This is a copy (not a wrapper) of getBuildCause() inAbstractProject
.protected Class<InheritanceBuild>
getBuildClass()
File
getBuildDir()
BuildDiscarder
getBuildDiscarder()
BuildDiscarder
getBuildDiscarder(InheritanceProject.IMode mode)
Inheritance-aware wrapper forgetBuildDiscarder()
Map<AbstractProjectReference,List<Builder>>
getBuildersFor(Map<String,Long> verMap, Class<?> clazz)
DescribableList<Builder,Descriptor<Builder>>
getBuildersList()
DescribableList<Builder,Descriptor<Builder>>
getBuildersList(InheritanceProject.IMode mode)
DescribableList<Builder,Descriptor<Builder>>
getBuildersListForVersion(Long versionId)
DescribableList<BuildWrapper,Descriptor<BuildWrapper>>
getBuildWrappersList()
DescribableList<BuildWrapper,Descriptor<BuildWrapper>>
getBuildWrappersList(InheritanceProject.IMode mode)
Collection<InheritanceProject>
getChildrenByBuildDate(Map<InheritanceProject,InheritanceProject.Relationship> relationships)
Returns the children in this relationship map ordered by last build start time, if a last build existsList<InheritanceProject>
getChildrenProjects()
List<AbstractProjectReference>
getCompatibleProjects()
List<AbstractProjectReference>
getCompatibleProjects(ProjectReference.PrioComparator.SELECTOR sortKey)
static Map<String,hudson.plugins.project_inheritance.projects.InheritanceProject.ProjectGraphNode>
getConnectionGraph()
String
getCreationClass()
VersionsNotification
getCurrentVersionNotification()
String
getCustomWorkspace()
String
getCustomWorkspace(InheritanceProject.IMode mode)
InheritanceProject.DescriptorImpl
getDescriptor()
Returns theDescriptor
for the parent object.
The returned object should be a class-singleton that can be used to create an instance of its parent class and thereafter display a configuration dialog.
As such, this class has the responsibility of creating a suitable instance, serving up the HTML/Jelly configuration fields, reading their values and modifying the created instance accordingly.
Do note that the configuration-dialog for the object is displayed after the instance was created.boolean
getHasCustomQuietPeriod()
String
getIconFileName()
boolean
getIsTransient()
static List<JobPropertyDescriptor>
getJobPropertyDescriptors(Class<? extends Job> clazz, boolean filterIsExcluding, String... filters)
Long
getLatestVersion()
LogRotator
getLogRotator()
Deprecated.as of 1.503 UsegetBuildDiscarder()
.LogRotator
getLogRotator(InheritanceProject.IMode mode)
Deprecated.as of 1.503 UsegetBuildDiscarder(IMode)
.Collection<InheritanceProject.Dependency>
getMissingDependencies()
Checks if there are missing dependencies somewhere in the inheritance or automated compound generation.Collection<?>
getOverrides()
Collection<?>
getOverrides(InheritanceProject.IMode mode)
List<InheritanceProject.ParameterDerivationDetails>
getParameterDerivationList()
String
getParameterizedWorkspace()
String
getParameterizedWorkspace(InheritanceProject.IMode mode)
List<ParameterDefinition>
getParameters()
List<ParameterDefinition>
getParameters(InheritanceProject.IMode mode)
AbstractMap.SimpleEntry<Boolean,String>
getParameterSanity()
This method checks if the current project has a valid set of parameters through inheritance.List<InheritanceProject>
getParentProjects()
Returns the immediate parents of this job in the order they have on the config page.List<AbstractProjectReference>
getParentReferences()
List<AbstractProjectReference>
getParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey)
static InheritanceProject
getProjectByName(String name)
Simple wrapper aroundJenkins.getItemByFullName(String, Class)
.static InheritanceProject
getProjectFromRequest(org.kohsuke.stapler.StaplerRequest req)
static Map<String,InheritanceProject>
getProjectsMap()
Deprecated.Do not use this function anymore, as its caching is somewhat unreliable in certain situations and it might cause deadlocks as it iterates over all items registered in Jenkins.String
getPronoun()
Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>>
getProperties()
Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>>
getProperties(InheritanceProject.IMode mode)
<T extends JobProperty>
TgetProperty(Class<T> clazz)
<T extends JobProperty>
TgetProperty(Class<T> clazz, InheritanceProject.IMode mode)
JobProperty
getProperty(String className)
JobProperty
getProperty(String className, InheritanceProject.IMode mode)
DescribableList<Publisher,Descriptor<Publisher>>
getPublishersList()
DescribableList<Publisher,Descriptor<Publisher>>
getPublishersList(InheritanceProject.IMode mode)
int
getQuietPeriod()
Integer
getQuietPeriodObject()
List<Action>
getRawActions()
List<JobProperty<? super InheritanceProject>>
getRawAllProperties()
This method will fetch all properties defined for the current project and only those defined on it.Label
getRawAssignedLabel()
boolean
getRawBlockBuildWhenDownstreamBuilding()
boolean
getRawBlockBuildWhenUpstreamBuilding()
DescribableList<Builder,Descriptor<Builder>>
getRawBuildersList()
DescribableList<BuildWrapper,Descriptor<BuildWrapper>>
getRawBuildWrappersList()
List<AbstractProjectReference>
getRawCompatibleProjects()
String
getRawCustomWorkspace()
String
getRawParameterizedWorkspace()
List<AbstractProjectReference>
getRawParentReferences()
DescribableList<Publisher,Descriptor<Publisher>>
getRawPublishersList()
Integer
getRawQuietPeriod()
SCM
getRawScm()
Integer
getRawScmCheckoutRetryCount()
SCMCheckoutStrategy
getRawScmCheckoutStrategy()
<T extends Trigger>
TgetRawTrigger(Class<T> clazz)
Map<TriggerDescriptor,Trigger<?>>
getRawTriggers()
List<Vector<String>>
getRelatedProjects()
Map<InheritanceProject,InheritanceProject.Relationship>
getRelationships()
Collection<InheritanceProject>
getRelationshipsOfType(InheritanceProject.Relationship.Type type)
File
getRootDir()
This method tells this class and all its superclass's which directory to use for storing stuff.SCM
getScm()
SCM
getScm(InheritanceProject.IMode mode)
int
getScmCheckoutRetryCount()
Integer
getScmCheckoutRetryCountObject()
SCMCheckoutStrategy
getScmCheckoutStrategy()
SCMCheckoutStrategy
getScmCheckoutStrategy(InheritanceProject.IMode mode)
Long
getStableVersion()
Deque<VersionedObjectStore.Version>
getStableVersions()
List<SubTask>
getSubTasks()
This needs to be overridden, becauseAbstractProject
reads the properties field directly; which circumvents inheritance.String
getSVGDetail()
Returns a multi-line string containing a detailed description of the node.String
getSVGLabel()
Returns the unique, one-line label for the node.URL
getSVGLabelLink()
The link to the node through the browser.Graph<SVGNode>
getSVGRelationGraph()
<T extends Trigger>
TgetTrigger(Class<T> clazz)
Gets the specific trigger, or null if the property is not configured for this job.<T extends Trigger>
TgetTrigger(Class<T> clazz, InheritanceProject.IMode mode)
Map<TriggerDescriptor,Trigger<?>>
getTriggers()
Returns all triggers defined on this project; or if detected to be necessary, also all parents.Map<TriggerDescriptor,Trigger<?>>
getTriggers(InheritanceProject.IMode mode)
String
getUserDesiredVersion()
Returns the currently desired version in the request state as a String.ParametersDefinitionProperty
getVarianceParameters()
VersionedObjectStore
getVersionedObjectStore()
protected File
getVersionFile()
Deque<Long>
getVersionIDs()
Deque<VersionedObjectStore.Version>
getVersions()
List<Widget>
getWidgets()
The above is overridden in a way, that the Build-History widget is removed if the build is abstract and can't be run anyway.boolean
hasCustomScmCheckoutRetryCount()
boolean
hasCyclicDependency()
Wrapper forhasCyclicDependency(String...)
with no new project references added on top of the existing ones.boolean
hasCyclicDependency(boolean addExisting, String... whenTheseProjectsAdded)
Tests if this project's configuration leads to a cyclic, diamond or multiple dependency.
See cycle detection and diamond problem.boolean
hasCyclicDependency(String[] whenTheseProjectsAdded)
Wrapper aroundhasCyclicDependency(boolean, String...)
, with addExisting set to true.boolean
isBuildable()
boolean
isConcurrentBuild()
boolean
isConcurrentBuild(InheritanceProject.IMode mode)
This method learns the actual value of concurrency, but is too slow to be executed thousands of times per second, as the Jenkins default scheduler often does.boolean
isConcurrentBuildFast(boolean inherit)
This method behaves similar toisConcurrentBuild(IMode)
, but will not even bother with versioning and skip reflection at all, if no inheritance is needed.boolean
isParameterized()
In Vanilla-Jenkins, this method is really just a glorious wrapper around the following call:boolean
isRawConcurrentBuild()
boolean
isRawParameterized()
protected VersionedObjectStore
loadVersionedObjectStore()
protected boolean
needsCreationClass()
This method decides, whether this class needs the 'project type' / 'creation class' box.protected void
onBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
This method may be used by projects extending from this class, to modify the build, shortly before it is passed over to scheduling.void
onCopiedFrom(Item src)
void
onLoad(ItemGroup<? extends Item> parent, String name)
This method restores transient fields that could not be deserialized.protected void
onScheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
This method may be used by projects extending from this class, to modify the build, shortly before it is actually submitted into the Queue.protected Object
readResolve()
boolean
removeParentReference(String name)
Removes a parent reference.void
renameTo(String newName)
String
renderSVGRelationGraph(int width, int height)
void
save()
This method serializes this object to offline storage.void
saveVersionedObjectStore()
QueueTaskFuture<InheritanceBuild>
scheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
void
setAssignedLabel(Label l)
void
setCreationClass(String creationClass)
void
setRawParameterizedWorkspace(String workspace)
Deprecated.Should only be used from within UnitTest classes.void
setScm(SCM scm)
This method is called by the configuration submission to set a new SCM.void
setVarianceLabel(String variance)
boolean
setVersionStability(long version, boolean stable)
protected void
submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
This method evaluates the form request created by the Descriptor and adjusts the properties of this project accordingly.String
toString()
void
updateByXml(Source source)
String
warnUserOnUnstableVersions()
protected void
writeStableConfigDotXml(OutputStream out)
-
Methods inherited from class hudson.model.Project
addPublisher, asItem, asProject, getBuilders, getBuildWrappers, getPublisher, getPublishers, getResourceActivities, getSCMs, getSCMTrigger, inferMavenInstallation, isFingerprintConfigured, removePublisher
-
Methods inherited from class hudson.model.AbstractProject
_getRuns, addProperty, addToList, addTrigger, buildDescribable, buildDescribable, checkAbortPermission, checkout, createExecutable, createHistoryWidget, disable, doBuild, doCheckRetryCount, doDoWipeOutWorkspace, doPolling, doWs, enable, findNearest, findNearest, getAuthToken, getBuild, getBuildByNumber, getBuildingDownstream, getBuildingUpstream, getBuildNowText, getBuildTriggerUpstreamProjects, getCauseOfBlockage, getDelay, getDownstreamProjects, getDownstreamProjectsForApi, getEnvironment, getFirstBuild, getIconColor, getJDK, getLastBuild, getLastBuiltOn, getLazyBuildMixIn, getModuleRoot, getModuleRoots, getNearestBuild, getNearestOldBuild, getProminentActions, getQueueItem, getRelationship, getRelevantLabels, getResourceList, getRootProject, getSameNodeConstraint, getSomeBuildWithWorkspace, getSomeWorkspace, getTransitiveDownstreamProjects, getTransitiveUpstreamProjects, getUpstreamProjects, getUpstreamProjectsForApi, getWorkspace, getWorkspaceResource, hasAbortPermission, hasParticipant, isConfigurable, isDisabled, isInQueue, loadBuild, makeSearchIndex, newBuild, onCreatedFromScratch, performDelete, poll, pollSCMChanges, removeFromList, removeRun, removeTrigger, resolveForCLI, scheduleBuild, scheduleBuild2, scheduleBuild2, scheduleBuild2, scheduleBuild2, schedulePolling, setAssignedNode, setBlockBuildWhenDownstreamBuilding, setBlockBuildWhenUpstreamBuilding, setConcurrentBuild, setCustomWorkspace, setDisabled, setJDK, setQuietPeriod, setScmCheckoutStrategy, supportsMakeDisabled, triggers, updateTransientActions
-
Methods inherited from class hudson.model.Job
assignBuildNumber, checkRename, delete, doBuildStatus, doChildrenContextMenu, doDescription, doDoRename, doRssAll, doRssChangelog, doRssFailed, getACL, getAllJobs, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusIconClassName, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, getEstimatedDuration, getEstimatedDurationCandidates, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getNewBuilds, getNextBuildNumber, getPermalinks, getTimeline, isBuilding, isHoldOffBuildUntilSave, isKeepDependencies, isLogUpdated, isNameEditable, logRotate, movedTo, removeProperty, removeProperty, saveNextBuildNumber, setBuildDiscarder, setLogRotator, supportsLogRotator, updateNextBuildNumber
-
Methods inherited from class hudson.model.AbstractItem
delete, doCheckNewName, doConfirmRename, doReload, doSetName, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getRelativeDisplayNameFrom, getRelativeNameFromGroup, getSearchName, getSearchUrl, getShortUrl, getTarget, getTaskNoun, getUrl, setDescription, setDisplayName, setDisplayNameOrNull, updateByXml, writeConfigDotXml, writeReplace
-
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getAllActions, removeAction, removeActions, replaceAction, replaceActions
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, 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.security.AccessControlled
checkAnyPermission, checkPermission, getACL, hasAnyPermission, hasPermission, hasPermission, hasPermission2
-
Methods inherited from interface hudson.model.BuildableItem
scheduleBuild, scheduleBuild
-
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
-
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCreatedFromScratch
-
Methods inherited from interface jenkins.model.ParameterizedJobMixIn.ParameterizedJob
doBuildWithParameters, doCancelQueue, doDisable, doEnable, getParameterizedJobMixIn, makeDisabled, scheduleBuild, scheduleBuild
-
Methods inherited from interface hudson.model.Queue.Task
checkAbortPermission, getAffinityKey, getCauseOfBlockage, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, getFullDisplayName, getName, getUrl, getWhyBlocked, hasAbortPermission, isBuildBlocked
-
Methods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceList
-
Methods inherited from interface jenkins.triggers.SCMTriggerItem
getNextBuildNumber, poll, scheduleBuild2, schedulePolling
-
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
-
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
-
Methods inherited from interface hudson.model.queue.SubTask
getEstimatedDuration, getLastBuiltOn, getOwnerTask, getSameNodeConstraint
-
-
-
-
Field Detail
-
onInheritChangeBuffer
protected static TimedBuffer<InheritanceProject,String> onInheritChangeBuffer
This buffer is used for objects that don't need to be repeatedly generated, as long as the configuration of this project or its parents has not changed. This class ensures that this buffer is cleared whenever the project or its parents are changed.- See Also:
createBuffers()
,clearBuffers(InheritanceProject)
-
onSelfChangeBuffer
protected static TimedBuffer<InheritanceProject,String> onSelfChangeBuffer
Same asonSelfChangeBuffer
, but this buffer is cleared only when the project itself is changed.- See Also:
createBuffers()
,clearBuffers(InheritanceProject)
-
onChangeBuffer
protected static TimedBuffer<InheritanceProject,String> onChangeBuffer
Same asonSelfChangeBuffer
, but this buffer is cleared when any project is changed or loaded anew.- See Also:
createBuffers()
,clearBuffers(InheritanceProject)
-
VERSION_CONFIG
public static Permission VERSION_CONFIG
-
variance
protected transient String variance
This field is only valid for transient jobs. It carries the additional, optional "variance" part as assigned by theProjectCreationEngine
during its creation.
-
versionStore
protected transient VersionedObjectStore versionStore
ThisVersionedObjectStore
is used to version all configurable properties of this class.Do note that transient projects (see
isTransient
) do not do versioning and always have an empty store. This is because they don't actually have a configuration of their own.
-
isTransient
protected final boolean isTransient
Flag to denote a transient project that is not serialized to disk.
-
isAbstract
public boolean isAbstract
Flag to denote a project that can't be built directly; but contrary to to theisBuildable()
value, additionally means that certain checks for inheritance consistence are relaxed. Not hidden, because the getting/setting this value is not checked anyway.
-
creationClass
protected String creationClass
This stores the name of the creation class this project falls in.- See Also:
ProjectCreationEngine
-
compatibleProjects
protected LinkedList<AbstractProjectReference> compatibleProjects
This list stores references to the projects this project was marked as being compatible with. For each project referenced in this list, theProjectCreationEngine
will try to create a new, transient project derived from both this project and the referenced one. It also checks if:-
The referenced project is compatible with this project
(see
creationClass
), - all parameters are correctly set,
- no circular, diamond or multiple inheritance is created,
- the resulting project is buildable and
- the newly created job does not already exist.
-
The referenced project is compatible with this project
(see
-
parentReferences
protected LinkedList<AbstractProjectReference> parentReferences
This list stores the adjacency relationship of this project to its parents. The order of objects is in most cases unimportant, as theProjectReference
class itself stores priorization details.Do note that any
AbstractProjectReference
not derived fromProjectReference
does not carry priority information and thus treated as having a priority of 0 everywhere.
-
parameterizedWorkspace
protected String parameterizedWorkspace
-
DESCRIPTOR
@Extension(ordinal=10000.0) public static final InheritanceProject.DescriptorImpl DESCRIPTOR
-
-
Method Detail
-
createConfigureVersionsPermission
@Initializer(after=STARTED) public static void createConfigureVersionsPermission()
This blank static initializer method will ensure that the class is loaded on start-up and that the VERSION_CONFIG permission is created.
-
readResolve
protected Object readResolve()
-
compareTo
public int compareTo(Project o)
- Specified by:
compareTo
in interfaceComparable<Project>
-
toString
public String toString()
- Overrides:
toString
in classAbstractItem
-
getIconFileName
public String getIconFileName()
-
getBuildClass
protected Class<InheritanceBuild> getBuildClass()
- Specified by:
getBuildClass
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getProjectsMap
@Deprecated public static Map<String,InheritanceProject> getProjectsMap()
Deprecated.Do not use this function anymore, as its caching is somewhat unreliable in certain situations and it might cause deadlocks as it iterates over all items registered in Jenkins.This method returns a mapping of project names to theInheritanceProject
objects that carry that name. Do note that this method is using aggressive buffering, to make sure that repeated access is running in O(1), instead of having to scan all defined projects again and again. The downside of this, is that you have to callclearBuffers(InheritanceProject)
with null, whenever a change to this mapping might have occurred.- Returns:
- a map of names to projects with guaranteed O(1) performance on repeated read access. The first invocation might run in O(n), where n is the number of Projects defined in Jenkins.
-
getProjectByName
@CheckForNull public static InheritanceProject getProjectByName(String name)
Simple wrapper aroundJenkins.getItemByFullName(String, Class)
.The class is set to
InheritanceProject
, of course.- Parameters:
name
- the full name of the item. May be null.- Returns:
- the project, if found, otherwise null.
-
createBuffers
public static void createBuffers()
-
clearBuffers
public static void clearBuffers(InheritanceProject root)
-
doConfigSubmit
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
- Overrides:
doConfigSubmit
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
This method evaluates the form request created by the Descriptor and adjusts the properties of this project accordingly.- Overrides:
submit
in classProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
updateByXml
public void updateByXml(Source source) throws IOException
- Overrides:
updateByXml
in classAbstractItem
- Throws:
IOException
-
doSubmitChildJobCreation
public void doSubmitChildJobCreation(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
renameTo
public void renameTo(String newName) throws IOException
- Overrides:
renameTo
in classJob<InheritanceProject,InheritanceBuild>
- Throws:
IOException
-
addParentReference
public void addParentReference(AbstractProjectReference ref, boolean duplicateCheck)
Adds the givenProjectReference
as a parent to this node.TODO: The fact that this function is public is really nasty. Basically, references should only be used through the validated frontend, or set by the equally validated
ProjectCreationEngine
.Of course, since the user can just scribble around in the XML -- if the job isn't transient -- we can't prevent broken references anyway.
Do note that this change will not trigger any versioning or saving to disk. If you use this, you need to know exactly what you're doing; for example calling this in proper UnitTests.
- Parameters:
ref
- the reference to addduplicateCheck
- if set to false, no duplication check shall be done. This is only useful in Unit-tests and nowhere else.
-
addParentReference
public void addParentReference(AbstractProjectReference ref)
Wrapper aroundaddParentReference(AbstractProjectReference, boolean)
with duplication check enabled.- Parameters:
ref
- the references to add as a parent.
-
removeParentReference
public boolean removeParentReference(String name)
Removes a parent reference.Same caveats apply as for
addParentReference(AbstractProjectReference)
.- Parameters:
name
- the name of the project for which to remove one parent reference.- Returns:
- true, if a parent reference was removed.
-
setVarianceLabel
public void setVarianceLabel(String variance)
-
setAssignedLabel
public void setAssignedLabel(Label l) throws IOException
- Overrides:
setAssignedLabel
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
-
setCreationClass
public void setCreationClass(String creationClass)
-
buildDependencyGraph
protected void buildDependencyGraph(DependencyGraph graph)
This method is called after a save to restructure the dependency graph. The triggering method isdoConfigSubmit(StaplerRequest, StaplerResponse)
.Before most methods in the super-class were de-synchronized, this method was dangerous, because two separate projects would trigger a graph rebuild and get stuck on each other.
As such, a global lock for all projects was added here. Since most methods are de-synchronized now, this method ought to be re-entrant save.
On the other hand, the global locking does not cause much loss of performance, since graph rebuilding only happens on saving of jobs.
Therefore, for the moment the global lock is still fine.
- Overrides:
buildDependencyGraph
in classProject<InheritanceProject,InheritanceBuild>
-
save
public void save() throws IOException
This method serializes this object to offline storage. The default implementation of Jenkins is XML-File based, but that can be overridden herein. Of course, if you override the saving method, you will also have to override the loading method fromInheritanceProject.DescriptorImpl
.- Specified by:
save
in interfaceItem
- Specified by:
save
in interfaceSaveable
- Overrides:
save
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
-
onLoad
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException
This method restores transient fields that could not be deserialized. Do note that there is no guaranteed order of deserialization, so don't expect other objects to be present, when this method is called.- Specified by:
onLoad
in interfaceItem
- Overrides:
onLoad
in classProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
-
onCopiedFrom
public void onCopiedFrom(Item src)
- Specified by:
onCopiedFrom
in interfaceItem
- Overrides:
onCopiedFrom
in classJob<InheritanceProject,InheritanceBuild>
-
getRootDir
public File getRootDir()
This method tells this class and all its superclass's which directory to use for storing stuff.For regular jobs this is the default Jenkins path for jobs ([root]/jobs). For transient jobs; this is redirected to ([root]/transient_jobs) to make them more invisible to Jenkins.
Note: Dynamically created project always exist in the root namespace.
- Specified by:
getRootDir
in interfacePersistenceRoot
- Overrides:
getRootDir
in classAbstractItem
-
getVersionFile
protected File getVersionFile()
-
getBuildDir
public File getBuildDir()
- Overrides:
getBuildDir
in classJob<InheritanceProject,InheritanceBuild>
-
doConfigDotXml
@WebMethod(name="config.xml") public void doConfigDotXml(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
Accepts config.xml submission, as well as serve it.- Overrides:
doConfigDotXml
in classAbstractItem
- Throws:
IOException
-
writeStableConfigDotXml
protected void writeStableConfigDotXml(OutputStream out) throws IOException, HttpStatusException
- Throws:
IOException
HttpStatusException
-
doGetConfigAsXML
public String doGetConfigAsXML(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
This method displays the configuration as a complete XML dump.- Parameters:
req
- the user-requestrsp
- the response sent as a reply- Returns:
- raw XML string
-
doGetParamExpansionsAsXML
public String doGetParamExpansionsAsXML()
This method dumps the full expansion of all parameters (even derived ones) based on their default values into an XML file.If you only want the default values of the last definition of each parameter, use
doGetParamDefaultsAsXML()
- Returns:
- raw XML string
-
doGetParamDefaultsAsXML
public String doGetParamDefaultsAsXML()
This method dumps the default values of all parameters (even derived ones) into an XML file.Do note that this does not do any expansion, it merely outputs the last default value defined for the given parameter. If you want the full expansion, call
doGetParamExpansionsAsXML()
- Returns:
- raw XML string
-
doGetVersionsAsXML
public String doGetVersionsAsXML()
This method dumps the version store as serialized XML.- Returns:
- the versions as an XML file. May be empty, but never null.
-
doGetVersionsAsCompressedXML
public String doGetVersionsAsCompressedXML()
This method dumps the version store as serialized, GZIP compressed, Base64 encoded XML.- Returns:
- the a Base64 encoded GZIP stream
-
doDoDelete
public void doDoDelete(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, InterruptedException
- Overrides:
doDoDelete
in classAbstractItem
- Throws:
IOException
javax.servlet.ServletException
InterruptedException
-
doComputeVersionDiff
public String doComputeVersionDiff(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
-
warnUserOnUnstableVersions
public String warnUserOnUnstableVersions()
-
getCurrentVersionNotification
public VersionsNotification getCurrentVersionNotification()
- Returns:
- the versioning notification based on the current user desired version.
- See Also:
VersionedObjectStore.getUserNotificationFor(Long)
-
onBuild
protected void onBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
This method may be used by projects extending from this class, to modify the build, shortly before it is passed over to scheduling.- Parameters:
req
- the user requestrsp
- the response to return- Throws:
IOException
- in case of errorjavax.servlet.ServletException
- in case of error
-
onScheduleBuild2
protected void onScheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
This method may be used by projects extending from this class, to modify the build, shortly before it is actually submitted into the Queue.- Parameters:
quietPeriod
- the number of seconds to delay the build.c
- the cause for this buildactions
- the actions added to the build
-
doBuild
public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException
Executes a build started from the GUI.Queries for parameters on an HTTP/GET, tries to decode submitted parameters on a HTTP/POST.
Before we can call the actual build, we must make sure that parameters are properly inherited; as the super implementation will NOT query
isParameterized()
, but instead rely on querying whether the Project has aParametersDefinitionProperty
property.As we need to treat Parameters created by ourselves different from those assigned by parents, we must override
getProperty(Class)
to produce a suitableParametersDefinitionProperty
reference on the spot.Do note that the
ParametersAction
objects that store the actual values will be created byParametersDefinitionProperty._doBuild(StaplerRequest, StaplerResponse, TimeDuration)
later on. Also do note that we can't extendParametersDefinitionProperty
orParametersAction
, becauseAbstractProject
only checks for exact class matches.- Specified by:
doBuild
in interfaceParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
- Throws:
IOException
javax.servlet.ServletException
-
doBuildSpecificVersion
public void doBuildSpecificVersion(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
This method is used, when the user wishes to build a very specific version of this project or its parents.This method comes in three stages:
- The first that displays the current versions, and allows the user to select the correct ones.
- The second, that parses the version map from JSON and refreshes the page
- The third, where the user actually wants to start the build.
doBuild(StaplerRequest, StaplerResponse, TimeDuration)
- Parameters:
req
- the incoming request from the user.rsp
- the response that shall be sent to the user- Throws:
IOException
- in case of saving issuesjavax.servlet.ServletException
- in case of server errorDescriptor.FormException
- in case of invalid input form data
-
filterVersionMap
protected void filterVersionMap(Map<String,Long> verMap)
This method simplifies the given versioning map, by removing all versions that superfluous.Superfluous versions are those:
- which are the last stable version of a project,
- the last version of a project without stable ones or
- the only version of a project.
- Parameters:
verMap
- the map to filter. Elements are removed in place.
-
doBuildWithParameters
public void doBuildWithParameters(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
- Overrides:
doBuildWithParameters
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
javax.servlet.ServletException
-
scheduleBuild2
public QueueTaskFuture<InheritanceBuild> scheduleBuild2(int quietPeriod, Cause c, Collection<? extends Action> actions)
Do note: This method is not calling the super-implementation, because it is not aware that the default values for parameters must be derived via inheritance, if the method is called directly (instead of via the CLI).
- Overrides:
scheduleBuild2
in classAbstractProject<InheritanceProject,InheritanceBuild>
- See Also:
InheritableStringParameterDefinition.getDefaultParameterValue()
-
getBuildCauseOverride
public CauseAction getBuildCauseOverride(org.kohsuke.stapler.StaplerRequest req)
This is a copy (not a wrapper) of getBuildCause() inAbstractProject
. This is necessary, because we can't access that field as our parent is loaded by a different class loader.The function is used, because we need to splice-in one additional
Action
for creation of Builds:VersioningAction
.Additional
Cause
are also queried over theBuildCauseOverride
extension interface.- Parameters:
req
- the incoming user request- Returns:
- an altered
CauseAction
extended by suitable actions.
-
doConfigVersionsSubmit
public void doConfigVersionsSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
loadVersionedObjectStore
protected VersionedObjectStore loadVersionedObjectStore()
-
dumpConfigToNewVersion
public void dumpConfigToNewVersion()
Wrapper arounddumpConfigToNewVersion(String)
with an empty message.This method should only be used outside the package, to allow test cases to generate new versions for test purposes.
External non-test code should not have any need to call this.
-
dumpConfigToNewVersion
public void dumpConfigToNewVersion(String message)
This method takes the current configuration and dumps all relevant fields into the versioning-store.Do note that versioning is stored separately from inheritance, but evaluated together. This means that, over time, parentage may change as well as compatibility markings. These all need to be saved indefinitely.
To save custom fields in subclasses, override
dumpConfigToVersion(Version)
.This method should only be used outside the package, to allow test cases to generate new versions for test purposes.
External non-test code should not have any need to call this.- Parameters:
message
- the message to be used for the new version
-
dumpConfigToVersion
protected void dumpConfigToVersion(VersionedObjectStore.Version v)
This method implements the actual association of a set of objects with a given version.Subclasses should override this method, call the super() implementation and then associate their own fields with that version by calling
VersionedObjectStore.setObjectFor(Version, String, Object)
.- Parameters:
v
- the version to archive settings for. Must never be null.
-
getProjectFromRequest
public static InheritanceProject getProjectFromRequest(org.kohsuke.stapler.StaplerRequest req)
-
getUserDesiredVersion
public String getUserDesiredVersion()
Returns the currently desired version in the request state as a String.It is used to determine the content of the version selection WEB UI element.
- Returns:
- the selected version, or the empty string, if no version available.
-
getVersions
public Deque<VersionedObjectStore.Version> getVersions()
-
getStableVersions
public Deque<VersionedObjectStore.Version> getStableVersions()
-
getVersionedObjectStore
public VersionedObjectStore getVersionedObjectStore()
-
saveVersionedObjectStore
public void saveVersionedObjectStore() throws IOException
- Throws:
IOException
-
getStableVersion
public Long getStableVersion()
-
getLatestVersion
public Long getLatestVersion()
-
setVersionStability
public boolean setVersionStability(long version, boolean stable)
-
getAllInheritedVersionsList
public List<InheritanceProject.InheritedVersionInfo> getAllInheritedVersionsList()
-
getAllInheritedVersionsList
public List<InheritanceProject.InheritedVersionInfo> getAllInheritedVersionsList(InheritanceBuild build)
Returns the versions for all parent projects (including the current one) based on the information in the given build.Do note that this method is recursive and will emit all parents. It is safe even in the case of cyclical references, even though these are not permitted/buildable.
- Parameters:
build
- the build for which to generate the versions.- Returns:
- a list of versions.
-
getAllInheritedVersionsList
public static List<InheritanceProject.InheritedVersionInfo> getAllInheritedVersionsList(InheritanceProject root, InheritanceBuild build)
Static part ofgetAllInheritedVersionsList(InheritanceBuild)
.This is needed, because an overriding class might want to override the member method, while still having access to this simple implementation.
An example would be to add projects that are not part of the inheritance tree to the list of versions (say, downstream projects). For the purpose of cycle-avoidance, calling this static method might be necessary.
- Parameters:
root
- the project for which to fetch versionsbuild
- the build for which to generate the versions.- Returns:
- a list of versions only derived from the inheritance relationship.
-
getChildrenProjects
public List<InheritanceProject> getChildrenProjects()
-
getParentProjects
public List<InheritanceProject> getParentProjects()
Returns the immediate parents of this job in the order they have on the config page.If you need the full scope of parents, use
InheritanceGovernor.getFullScopeOrdered(InheritanceProject, SELECTOR, Set)
- Returns:
- a list of projects. May be empty, but never null.
-
setScm
public void setScm(SCM scm) throws IOException
This method is called by the configuration submission to set a new SCM. This does not need to care about inheritance or versioning, as this function should only be invoked fromdoConfigSubmit(StaplerRequest, StaplerResponse)
.- Overrides:
setScm
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Throws:
IOException
-
getParentReferences
public List<AbstractProjectReference> getParentReferences()
-
getParentReferences
public List<AbstractProjectReference> getParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey)
-
getRawParentReferences
public List<AbstractProjectReference> getRawParentReferences()
-
getAllParentReferences
public List<AbstractProjectReference> getAllParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey)
This method returns a list of all parent references.DO NOT use this method inside any function from
InheritanceGovernor
or any method called by it, because that will almost always lead to an infinite recursion.- Parameters:
sortKey
- the key specifying the order in which projects are returned.- Returns:
- a list of all parent references
-
getAllParentReferences
public List<AbstractProjectReference> getAllParentReferences(ProjectReference.PrioComparator.SELECTOR sortKey, boolean addSelf)
Wrapper forgetAllParentReferences(ProjectReference.PrioComparator.SELECTOR)
, but will add a reference to this project too, if needed.- Parameters:
sortKey
- the key specifying the order in which projects are returned.addSelf
- if true, add a self-reference in the correct spot- Returns:
- a list of all parent references, including a self-reference if addSelf is true.
-
getCompatibleProjects
public List<AbstractProjectReference> getCompatibleProjects()
-
getCompatibleProjects
public List<AbstractProjectReference> getCompatibleProjects(ProjectReference.PrioComparator.SELECTOR sortKey)
-
getRawCompatibleProjects
public List<AbstractProjectReference> getRawCompatibleProjects()
-
getActions
public List<Action> getActions()
- Overrides:
getActions
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getActions
public List<Action> getActions(InheritanceProject.IMode mode)
-
createTransientActions
protected final List<Action> createTransientActions()
Overrides the super-function to always return an empty list. This is vitally important so that the super class' transientActions member is always kept empty.Otherwise, you get the nasty problems that temporary actions contaminate the versioning archive and generally cause troubles during build.
The downside with generating this on-the-fly is, that some plugins themselves call
getActions()
(maybe indirectly), which recurses back into callingcreateVersionAwareTransientActions()
.This will cause a stack overflow. The only way to fix this is to return an empty list if a recursion is detected.
This function is made final, to avoid any superclass to return something else other than an empty list. Supertypes must override
createVersionAwareTransientActions()
to contribute transient actions.- Overrides:
createTransientActions
in classProject<InheritanceProject,InheritanceBuild>
- See Also:
getActions()
,getActions(IMode)
-
createVersionAwareTransientActions
protected List<Action> createVersionAwareTransientActions()
Creates a list of temporaryAction
s as they are contributed by the various Builders, Publishers, etc. from the correct version and with the the correct inheritance.Note: This overrides the implementation of the super-classes, because
AbstractProject
accesses the Properties of the class directly without callinggetProperties()
, which circumvents inheritance.As such, the code needs to be copied as-is, unless the Jenkins Core gets changed on that point.
- Returns:
- a temporary list of actions.
-
getBuildersListForVersion
public DescribableList<Builder,Descriptor<Builder>> getBuildersListForVersion(Long versionId)
-
getBuildersList
public DescribableList<Builder,Descriptor<Builder>> getBuildersList()
- Overrides:
getBuildersList
in classProject<InheritanceProject,InheritanceBuild>
-
getBuildersList
public DescribableList<Builder,Descriptor<Builder>> getBuildersList(InheritanceProject.IMode mode)
-
getRawBuildersList
public DescribableList<Builder,Descriptor<Builder>> getRawBuildersList()
-
getBuildWrappersList
public DescribableList<BuildWrapper,Descriptor<BuildWrapper>> getBuildWrappersList()
- Specified by:
getBuildWrappersList
in interfaceBuildableItemWithBuildWrappers
- Overrides:
getBuildWrappersList
in classProject<InheritanceProject,InheritanceBuild>
-
getBuildWrappersList
public DescribableList<BuildWrapper,Descriptor<BuildWrapper>> getBuildWrappersList(InheritanceProject.IMode mode)
-
getRawBuildWrappersList
public DescribableList<BuildWrapper,Descriptor<BuildWrapper>> getRawBuildWrappersList()
-
getPublishersList
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
- Overrides:
getPublishersList
in classProject<InheritanceProject,InheritanceBuild>
-
getPublishersList
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList(InheritanceProject.IMode mode)
-
getRawPublishersList
public DescribableList<Publisher,Descriptor<Publisher>> getRawPublishersList()
-
getTriggers
public Map<TriggerDescriptor,Trigger<?>> getTriggers()
Returns all triggers defined on this project; or if detected to be necessary, also all parents.- Specified by:
getTriggers
in interfaceParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
- Overrides:
getTriggers
in classAbstractProject<InheritanceProject,InheritanceBuild>
- Returns:
- a map of triggers, might be empty, but never null
-
getTriggers
public Map<TriggerDescriptor,Trigger<?>> getTriggers(InheritanceProject.IMode mode)
-
getRawTriggers
public Map<TriggerDescriptor,Trigger<?>> getRawTriggers()
-
getTrigger
public <T extends Trigger> T getTrigger(Class<T> clazz)
Gets the specific trigger, or null if the property is not configured for this job.- Overrides:
getTrigger
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getTrigger
public <T extends Trigger> T getTrigger(Class<T> clazz, InheritanceProject.IMode mode)
-
getProperties
public Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>> getProperties()
- Overrides:
getProperties
in classJob<InheritanceProject,InheritanceBuild>
-
getProperties
public Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>> getProperties(InheritanceProject.IMode mode)
-
getAllProperties
@Exported(name="property", inline=true) public List<JobProperty<? super InheritanceProject>> getAllProperties()
- Overrides:
getAllProperties
in classJob<InheritanceProject,InheritanceBuild>
-
getAllProperties
public List<JobProperty<? super InheritanceProject>> getAllProperties(InheritanceProject.IMode mode)
-
getRawAllProperties
public List<JobProperty<? super InheritanceProject>> getRawAllProperties()
This method will fetch all properties defined for the current project and only those defined on it.- Returns:
- the local list of properties.
-
getVarianceParameters
public ParametersDefinitionProperty getVarianceParameters()
-
getProperty
public <T extends JobProperty> T getProperty(Class<T> clazz)
- Overrides:
getProperty
in classJob<InheritanceProject,InheritanceBuild>
-
getProperty
public <T extends JobProperty> T getProperty(Class<T> clazz, InheritanceProject.IMode mode)
-
getProperty
public JobProperty getProperty(String className)
- Overrides:
getProperty
in classJob<InheritanceProject,InheritanceBuild>
-
getProperty
public JobProperty getProperty(String className, InheritanceProject.IMode mode)
-
getOverrides
public Collection<?> getOverrides()
- Specified by:
getOverrides
in interfaceorg.kohsuke.stapler.StaplerOverridable
- Overrides:
getOverrides
in classJob<InheritanceProject,InheritanceBuild>
-
getOverrides
public Collection<?> getOverrides(InheritanceProject.IMode mode)
-
getSubTasks
public List<SubTask> getSubTasks()
This needs to be overridden, becauseAbstractProject
reads the properties field directly; which circumvents inheritance.- Specified by:
getSubTasks
in interfaceQueue.Task
- Overrides:
getSubTasks
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getParameters
public List<ParameterDefinition> getParameters()
-
getParameters
public List<ParameterDefinition> getParameters(InheritanceProject.IMode mode)
-
getScm
public SCM getScm()
- Overrides:
getScm
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getScm
public SCM getScm(InheritanceProject.IMode mode)
-
getRawScm
public SCM getRawScm()
-
getQuietPeriod
public int getQuietPeriod()
- Specified by:
getQuietPeriod
in interfaceParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
- Specified by:
getQuietPeriod
in interfaceSCMTriggerItem
- Overrides:
getQuietPeriod
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getQuietPeriodObject
public Integer getQuietPeriodObject()
-
getRawQuietPeriod
public Integer getRawQuietPeriod()
-
getHasCustomQuietPeriod
public boolean getHasCustomQuietPeriod()
- Overrides:
getHasCustomQuietPeriod
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getScmCheckoutRetryCount
public int getScmCheckoutRetryCount()
- Overrides:
getScmCheckoutRetryCount
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getScmCheckoutRetryCountObject
public Integer getScmCheckoutRetryCountObject()
-
getRawScmCheckoutRetryCount
public Integer getRawScmCheckoutRetryCount()
-
hasCustomScmCheckoutRetryCount
public boolean hasCustomScmCheckoutRetryCount()
- Overrides:
hasCustomScmCheckoutRetryCount
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getScmCheckoutStrategy
public SCMCheckoutStrategy getScmCheckoutStrategy()
- Overrides:
getScmCheckoutStrategy
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getScmCheckoutStrategy
public SCMCheckoutStrategy getScmCheckoutStrategy(InheritanceProject.IMode mode)
-
getRawScmCheckoutStrategy
public SCMCheckoutStrategy getRawScmCheckoutStrategy()
-
blockBuildWhenDownstreamBuilding
public boolean blockBuildWhenDownstreamBuilding()
- Overrides:
blockBuildWhenDownstreamBuilding
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
blockBuildWhenDownstreamBuilding
public boolean blockBuildWhenDownstreamBuilding(InheritanceProject.IMode mode)
-
getRawBlockBuildWhenDownstreamBuilding
public boolean getRawBlockBuildWhenDownstreamBuilding()
-
blockBuildWhenUpstreamBuilding
public boolean blockBuildWhenUpstreamBuilding()
- Overrides:
blockBuildWhenUpstreamBuilding
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
blockBuildWhenUpstreamBuilding
public boolean blockBuildWhenUpstreamBuilding(InheritanceProject.IMode mode)
-
getRawBlockBuildWhenUpstreamBuilding
public boolean getRawBlockBuildWhenUpstreamBuilding()
-
getCustomWorkspace
public String getCustomWorkspace()
- Overrides:
getCustomWorkspace
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getCustomWorkspace
public String getCustomWorkspace(InheritanceProject.IMode mode)
-
getRawCustomWorkspace
public String getRawCustomWorkspace()
-
getParameterizedWorkspace
public String getParameterizedWorkspace()
-
getParameterizedWorkspace
public String getParameterizedWorkspace(InheritanceProject.IMode mode)
-
getRawParameterizedWorkspace
public String getRawParameterizedWorkspace()
-
setRawParameterizedWorkspace
@Deprecated public void setRawParameterizedWorkspace(String workspace)
Deprecated.Should only be used from within UnitTest classes.Sets the parameterized workspace variable.- Parameters:
workspace
- the new value for the parameterized workspace
-
getLogRotator
@Deprecated public LogRotator getLogRotator()
Deprecated.as of 1.503 UsegetBuildDiscarder()
.- Overrides:
getLogRotator
in classJob<InheritanceProject,InheritanceBuild>
-
getLogRotator
@Deprecated public LogRotator getLogRotator(InheritanceProject.IMode mode)
Deprecated.as of 1.503 UsegetBuildDiscarder(IMode)
.Inheritance-aware Handler forgetLogRotator()
- Parameters:
mode
- the inheritance mode- Returns:
- the
BuildDiscarder
as aLogRotator
.
-
getBuildDiscarder
public BuildDiscarder getBuildDiscarder()
- Overrides:
getBuildDiscarder
in classJob<InheritanceProject,InheritanceBuild>
-
getBuildDiscarder
public BuildDiscarder getBuildDiscarder(InheritanceProject.IMode mode)
Inheritance-aware wrapper forgetBuildDiscarder()
- Parameters:
mode
- the inheritance mode to use- Returns:
- a build discarder, or null if none is present
-
getAssignedLabel
public Label getAssignedLabel()
Contrary to all the other properties methods, this will ALWAYS return the fully inherited version and will cache the result.
This is done, because the only time when no inheritance is needed, is when the project is configured, and this will callgetAssignedLabel(IMode)
instead with theInheritanceProject.IMode.LOCAL_ONLY
set.The reason for the caching is, that this method is called quite often by
Queue.maintain()
, a function that potentially blocks the entire server from progressing with builds.
Thus, this method must take the minimum possible amount of time, which means that reflection is too expensive.This has the downside of this method ignoring versioning completely, which might affect the result of this call through changing the inheritance. This is an accepted break, compared to the potential slowdown of
Queue.maintain()
under high queue load situations.- Specified by:
getAssignedLabel
in interfaceSubTask
- Overrides:
getAssignedLabel
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getAssignedLabel
public Label getAssignedLabel(InheritanceProject.IMode mode)
-
getRawAssignedLabel
public Label getRawAssignedLabel()
-
getAssignedLabelString
public String getAssignedLabelString()
- Overrides:
getAssignedLabelString
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
isConcurrentBuild
@Exported public boolean isConcurrentBuild()
- Specified by:
isConcurrentBuild
in interfaceQueue.Task
- Overrides:
isConcurrentBuild
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
isConcurrentBuildFast
public boolean isConcurrentBuildFast(boolean inherit)
This method behaves similar toisConcurrentBuild(IMode)
, but will not even bother with versioning and skip reflection at all, if no inheritance is needed.- Parameters:
inherit
- whether or not to care about inheritance (versioning is always ignored)- Returns:
- true, if the job is set to run concurrently.
-
isConcurrentBuild
public boolean isConcurrentBuild(InheritanceProject.IMode mode)
This method learns the actual value of concurrency, but is too slow to be executed thousands of times per second, as the Jenkins default scheduler often does.For faster, non-reflected access, use
isConcurrentBuildFast(boolean)
, if you can live without versioning.- Parameters:
mode
- the inheritance mode- Returns:
- true, if the job is set to run concurrently.
-
isRawConcurrentBuild
public boolean isRawConcurrentBuild()
-
isParameterized
public boolean isParameterized()
In Vanilla-Jenkins, this method is really just a glorious wrapper around the following call:return getProperty(ParametersDefinitionProperty.class) != null;
That means, its entire inheritance-based implementation would already be covered by
getProperty(Class)
. But unfortunately, this is not something we can rely on, as this function — even though it's just a wrapper — fulfills a very specific role:When Jenkins creates the sidepanel of a job, it queries this function to determine, whether the "Build Now" button should trigger a POST (if not parameterized) or a GET (if parameters need to be queried). Thus, this function must always return true, if any parent project is parameterized.
As such, contrary to the other functions, this function must always explore full inheritance.
- Specified by:
isParameterized
in interfaceParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
-
isRawParameterized
public boolean isRawParameterized()
-
isBuildable
public boolean isBuildable()
- Specified by:
isBuildable
in interfaceParameterizedJobMixIn.ParameterizedJob<InheritanceProject,InheritanceBuild>
- Overrides:
isBuildable
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getIsTransient
public boolean getIsTransient()
-
getCreationClass
public String getCreationClass()
-
needsCreationClass
protected boolean needsCreationClass()
This method decides, whether this class needs the 'project type' / 'creation class' box.If it returns true, the Groovy UI code will render a box with a drop-down allowing the user to change the value of
getCreationClass()
.If false, the project type / creation class will always be set to and return null.
Marked as protected, since only subclasses should need to access or alter this value. External code should not need to know this at all.
Defaults to 'true', unless overridden.
- Returns:
- true, if the project type is needed
-
getConnectionGraph
public static Map<String,hudson.plugins.project_inheritance.projects.InheritanceProject.ProjectGraphNode> getConnectionGraph()
-
getRelationshipsOfType
public Collection<InheritanceProject> getRelationshipsOfType(InheritanceProject.Relationship.Type type)
-
getChildrenByBuildDate
public Collection<InheritanceProject> getChildrenByBuildDate(Map<InheritanceProject,InheritanceProject.Relationship> relationships)
Returns the children in this relationship map ordered by last build start time, if a last build exists- Parameters:
relationships
- the map containing the inheritance relationships- Returns:
- a collections of children, ordered by their last build start date.
-
getRelationships
public Map<InheritanceProject,InheritanceProject.Relationship> getRelationships()
-
getParameterDerivationList
public List<InheritanceProject.ParameterDerivationDetails> getParameterDerivationList()
-
getSVGLabel
public String getSVGLabel()
Description copied from interface:SVGNode
Returns the unique, one-line label for the node.- Specified by:
getSVGLabel
in interfaceSVGNode
- Returns:
- a unique string for this node
-
getSVGDetail
public String getSVGDetail()
Description copied from interface:SVGNode
Returns a multi-line string containing a detailed description of the node. Line breaks are preserved when writing out the detail.- Specified by:
getSVGDetail
in interfaceSVGNode
- Returns:
- a string describing the important properties of the node.
-
getSVGLabelLink
public URL getSVGLabelLink()
Description copied from interface:SVGNode
The link to the node through the browser. May be null.- Specified by:
getSVGLabelLink
in interfaceSVGNode
- Returns:
- a
URL
that specifies the link anchor that leads users to the object represented by this node.
-
doRenderSVGRelationGraph
public String doRenderSVGRelationGraph()
-
renderSVGRelationGraph
public String renderSVGRelationGraph(int width, int height)
-
getMissingDependencies
public final Collection<InheritanceProject.Dependency> getMissingDependencies()
Checks if there are missing dependencies somewhere in the inheritance or automated compound generation.Returns the information about all the missing references as a
InheritanceProject.Dependency
instance. This includes the full trackback from the current project.- Returns:
- a list of missing
InheritanceProject.Dependency
instances. May be empty, but never null. - See Also:
ProjectCreationEngine
-
hasCyclicDependency
public final boolean hasCyclicDependency()
Wrapper forhasCyclicDependency(String...)
with no new project references added on top of the existing ones.Note, that the result is cached and only refreshed when this job or its parents change. This is done, because cycle checks are expensive and this method is called often.
This means, that the result of this method is not version aware. If you need an uncached and version-aware result, call
hasCyclicDependency(boolean, String...)
directly.- Returns:
- true, if a cycle or diamond was detected.
-
hasCyclicDependency
public final boolean hasCyclicDependency(String[] whenTheseProjectsAdded)
Wrapper aroundhasCyclicDependency(boolean, String...)
, with addExisting set to true.- Parameters:
whenTheseProjectsAdded
- the project to check for cycles for- Returns:
- true, if there is a cyclic, diamond or repeated dependency among this project's parents.
-
hasCyclicDependency
public final boolean hasCyclicDependency(boolean addExisting, String... whenTheseProjectsAdded)
Tests if this project's configuration leads to a cyclic, diamond or multiple dependency.
See cycle detection and diamond problem.- Parameters:
addExisting
- whether or not to consider existing jobs for cyclicality.whenTheseProjectsAdded
- projects about to be added to the dependency graph- Returns:
- true, if there is a cyclic, diamond or repeated dependency among this project's parents.
-
getParameterSanity
public final AbstractMap.SimpleEntry<Boolean,String> getParameterSanity()
This method checks if the current project has a valid set of parameters through inheritance.Do note that this check is different from and complementary to
InheritanceParametersDefinitionProperty.checkParameterSanity(InheritanceBuild, hudson.model.BuildListener)
.Of special note here is that this method does not (and can't) check the final values of the variables. This mostly affects the 'mustBeAssigned' flag.
- Returns:
- a tuple of whether the assignment is sane and a human-readable representation of the error -- if any.
-
getPronoun
public String getPronoun()
- Overrides:
getPronoun
in classAbstractProject<InheritanceProject,InheritanceBuild>
-
getWidgets
public List<Widget> getWidgets()
The above is overridden in a way, that the Build-History widget is removed if the build is abstract and can't be run anyway. This is ignored, in case there is a last build, though, to not hide any information.- Overrides:
getWidgets
in classJob<InheritanceProject,InheritanceBuild>
-
getJobPropertyDescriptors
public static List<JobPropertyDescriptor> getJobPropertyDescriptors(Class<? extends Job> clazz, boolean filterIsExcluding, String... filters)
-
getBuildersFor
public Map<AbstractProjectReference,List<Builder>> getBuildersFor(Map<String,Long> verMap, Class<?> clazz)
-
getDescriptor
public InheritanceProject.DescriptorImpl getDescriptor()
Returns theDescriptor
for the parent object.
The returned object should be a class-singleton that can be used to create an instance of its parent class and thereafter display a configuration dialog.
As such, this class has the responsibility of creating a suitable instance, serving up the HTML/Jelly configuration fields, reading their values and modifying the created instance accordingly.
Do note that the configuration-dialog for the object is displayed after the instance was created.- Specified by:
getDescriptor
in interfaceDescribable<TopLevelItem>
- Specified by:
getDescriptor
in interfaceTopLevelItem
-
-