Class Jenkins
- All Implemented Interfaces:
ExtensionPoint
,Describable<Node>
,DescriptorByNameOwner
,ItemGroup<TopLevelItem>
,ModelObject
,ModifiableItemGroup<TopLevelItem>
,ModifiableViewGroup
,PersistenceRoot
,ReconfigurableDescribable<Node>
,Saveable
,ViewGroup
,SearchableModelObject
,SearchItem
,AccessControlled
,DirectlyModifiableTopLevelItemGroup
,Loadable
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,ModifiableTopLevelItemGroup
,OnMaster
,org.kohsuke.stapler.StaplerFallback
,org.kohsuke.stapler.StaplerProxy
- Direct Known Subclasses:
Hudson
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static final class
static class
static interface
Hook for a test harness to intercept Jenkins.get() Do not use in the production code as the signature may change.static class
static class
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, ModelObjectWithContextMenu.MenuItemType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Permission
final List<AdministrativeMonitor>
AdministrativeMonitor
s installed on this system.Extension list thatdoResources(StaplerRequest2, StaplerResponse2)
can serve.static final Authentication
Deprecated.static final org.springframework.security.core.Authentication
Authentication
object that represents the anonymous user.static boolean
Automatically try to launch an agent when Jenkins is initialized or a new agent computer is created.static String
final Hudson.CloudList
ActiveCloud
s.protected final ConcurrentMap<Node,
Computer> Computer
s in this Jenkins system.static boolean
Deprecated.as of 1.464 This flag will have no effect.static int
The amount of time by which to extend the startup notification timeout as each initialization milestone is attained.static boolean
Deprecated.No longer used.static boolean
Live view of recentLogRecord
s produced by Jenkins.final Lookup
Stores various objects scoped toJenkins
.static final Permission
This permission grants access to parts of the Jenkins system configuration.static final Permission[]
static final String
Name of the system property escape hatch for SECURITY-2424.final OverallLoadStatistics
Load statistics of the entire system.final NodeProvisioner
Deprecated.as of 1.467 UseunlabeledNodeProvisioner
.static boolean
static final PermissionGroup
final PluginManager
Loaded plugins.HTTP proxy configuration.static final Permission
static String
Prefix to static resources like images and javascripts in the war file.final File
Root directory of the system.static final Permission
Deprecated.in Jenkins 2.222 useADMINISTER
insteadfinal javax.servlet.ServletContext
Deprecated.static String
Unique random token that identifies the current session.protected NodeList
Deprecated.in favour ofNodes
static final Permission
Allows read-only access to large parts of the system configuration.static final String
The version number before it is "computed" (by a call to computeVersion()).final LoadStatistics
Load statistics of the free roaming jobs and agents.final NodeProvisioner
NodeProvisioner
that reacts tounlabeledLoad
.static String
Version number of this Jenkins.static String
Hash ofVERSION
.static String
Prefix to resources alongside view scripts.static final com.thoughtworks.xstream.XStream
Thread-safe reusableXStream
.static final XStream2
Fields inherited from class hudson.model.AbstractCIBase
LOG_STARTUP_PERFORMANCE
Fields inherited from class hudson.model.Node
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
Jenkins
(File root, jakarta.servlet.ServletContext context, PluginManager pluginManager) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
_doScript
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, jakarta.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) static void
_doScript
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, javax.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) _getFingerprint
(String md5sum) Gets aFingerprint
object if it exists.<I extends TopLevelItem>
IAdds an item to this group.void
Adds one moreNode
to Jenkins.void
boolean
canAdd
(TopLevelItem item) Returns true if a particular item may be added to this group.boolean
Determine whether a view may be deleted.checkDisplayName
(String displayName, TopLevelItem item) Checks to see if the candidate displayName collides with any existing display names or project names in the items parent groupstatic void
checkGoodName
(String name) Check if the given name is suitable as a name for job, view, etc.void
cleanUp()
Called to shut down the system.<T extends TopLevelItem>
TCopies a job.createLauncher
(TaskListener listener) Returns aLauncher
for executing programs on this node.createPath
(String absolutePath) Gets theFilePath
on this node.createProject
(TopLevelItemDescriptor type, String name) createProject
(TopLevelItemDescriptor type, String name, boolean notify) Creates a new job.<T extends TopLevelItem>
TcreateProject
(Class<T> type, String name) Creates a new job.createProjectFromXML
(String name, InputStream xml) Creates a new job from its configuration XML.void
deleteView
(View view) Deletes a view in this group.void
org.kohsuke.stapler.HttpRedirect
Cancel previous quiet down Jenkins - preparation for a restartdoCheckDisplayName
(String displayName, String jobName) doCheckURIEncoding
(org.kohsuke.stapler.StaplerRequest2 request) Deprecated.doCheckViewName
(String value) Checks if a top-level view with the given name exists and make sure that the name is good as a view name.doChildrenContextMenu
(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Generates the context menu to list up all the children.void
doClassicThreadDump
(org.kohsuke.stapler.StaplerResponse2 rsp) Backward compatibility.void
doConfigExecutorsSubmit
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts submission from the node configuration page.void
doConfigSubmit
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts submission from the configuration page.doContextMenu
(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Generates the context menu.doCreateItem
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) The request format follows that of<n:form xmlns:n="/lib/form">
.void
doCreateView
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) doDefaultJDKCheck
(org.kohsuke.stapler.StaplerRequest2 request, String value) If the user chose the default JDK, make sure we got 'java' in PATH.void
doDoFingerprintCheck
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Do a finger-print check.void
doEval
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Evaluates the Jelly script submitted by the client.void
End point that intentionally throws an exception to test the error behaviour.void
doExit
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Shutdown the system.void
doFingerprintCleanup
(org.kohsuke.stapler.StaplerResponse2 rsp) void
doGc
(org.kohsuke.stapler.StaplerResponse2 rsp) For debugging.void
doIconSize
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Changes the icon size by changing the cookiedoJnlpJars
(org.kohsuke.stapler.StaplerRequest2 req) void
doLoginEntry
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Called once the user logs in.void
doLogout
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Logs out the user.void
doLogout
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.org.kohsuke.stapler.HttpRedirect
org.kohsuke.stapler.HttpRedirect
doQuietDown
(boolean block, int timeout) Deprecated.since 2.267; usedoQuietDown(boolean, int, String, boolean)
instead.org.kohsuke.stapler.HttpRedirect
doQuietDown
(boolean block, int timeout, String message) Deprecated.usedoQuietDown(boolean, int, String, boolean)
instead.org.kohsuke.stapler.HttpRedirect
doQuietDown
(boolean block, int timeout, String message, boolean safeRestart) Quiet down Jenkins - preparation for a restartorg.kohsuke.stapler.HttpResponse
doReload()
Reloads the configuration.void
doResources
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Serves static resources placed along with Jelly view files.void
doRestart
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Perform a restart of Jenkins, if we can.org.kohsuke.stapler.HttpResponse
doSafeExit
(org.kohsuke.stapler.StaplerRequest req) Deprecated.org.kohsuke.stapler.HttpResponse
doSafeExit
(org.kohsuke.stapler.StaplerRequest2 req) Shutdown the system safely.org.kohsuke.stapler.HttpResponse
doSafeRestart
(org.kohsuke.stapler.StaplerRequest req) Deprecated.usedoSafeRestart(StaplerRequest2, String)
instead.org.kohsuke.stapler.HttpResponse
doSafeRestart
(org.kohsuke.stapler.StaplerRequest2 req, String message) Queues up a safe restart of Jenkins.org.kohsuke.stapler.HttpResponse
doSafeRestart
(org.kohsuke.stapler.StaplerRequest req, String message) Deprecated.void
doScript
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) For system diagnostics.void
doScript
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.void
doScriptText
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Run arbitrary Groovy script and return result as plain text.void
doScriptText
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.void
doSecured
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Checks if the user was successfully authenticated.void
doSignup
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Sign up for the user account.void
Simulates OutOfMemoryError.void
doSubmitDescription
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts the new description.void
doTestPost
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) org.kohsuke.stapler.HttpResponse
Binds /userContent/...doViewExistsCheck
(String value) Deprecated.1.512void
doWorkspaceCleanup
(org.kohsuke.stapler.StaplerResponse2 rsp) static String
expandVariablesForDirectory
(String base, String itemFullName, String itemRootDir) void
generateNotFoundResponse
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Serve a custom 404 error page, configured in web.xml.static Jenkins
get()
Gets theJenkins
singleton.getACL()
Returns the rootACL
.Returns the transientAction
s associated with the top page.Returns the enabled and activated administrative monitors accessible to the current user.static Jenkins
Deprecated.This is a verbose historical alias forget()
.org.kohsuke.stapler.framework.adjunct.AdjunctManager
getAdjuncts
(String dummy) MakesAdjunctManager
URL-bound.BindsAdministrativeMonitor
s to URL.Returns the enabled agent protocols.Obtains the thread dump of all agents (including the controller/built-in node.)getApi()
static Authentication
Deprecated.static org.springframework.security.core.Authentication
Gets theAuthentication
object that represents the user associated with the current request.getBuildDirFor
(Job job) getBuilder
(String shortClassName) Gets the builder descriptor by name.getBuildWrapper
(String shortClassName) Gets the build wrapper descriptor by name.Estimates the clock difference with this agent.hudson.remoting.Callable<ClockDifference,
IOException> Returns aCallable
that when run on the channel, estimates the clock difference.getCloud()
Only there to bind to /cloud/ URL.Deprecated.UI method.getComputer
(String name) protected ConcurrentMap<Node,
Computer> Computer[]
Gets the read-only list of allComputer
s.protected XmlFile
The file we save our configuration.Exported alias forJenkinsLocationConfiguration.getUrl()
.Gets theCrumbIssuer
currently in use.Gets the descriptor for this instance.getDescriptor
(Class<? extends Describable> type) Gets theDescriptor
that corresponds to the givenDescribable
type.getDescriptor
(String id) ExposesDescriptor
by its name to URL.Alias forgetDescriptor(String)
.<T extends Descriptor>
TgetDescriptorByType
(Class<T> type) Gets theDescriptor
instance in the current Jenkins by its type.<T extends Describable<T>,
D extends Descriptor<T>>
DescriptorExtensionList<T,D> getDescriptorList
(Class<T> type) ReturnsExtensionList
that retains the discoveredDescriptor
instances for the given kind ofDescribable
.getDescriptorOrDie
(Class<? extends Describable> type) Works just likegetDescriptor(Class)
but don't take no for an answer.getDynamic
(String token) <T> ExtensionList<T>
getExtensionList
(Class<T> extensionType) ReturnsExtensionList
that retains the discovered instances for the given extension type.getExtensionList
(String extensionType) Used to bindExtensionList
s to URLs.getFingerprint
(String md5sum) Gets the full name of thisItemGroup
.Obtains the heap dump.Gets the initialization milestone that we've already reached.com.google.inject.Injector
Gets the dependency injection container that hosts all the extension implementations and other components in Jenkins.Get the Jenkinsinstall state
.static Jenkins
Deprecated.This is a historical alias forgetInstanceOrNull()
but with ambiguous nullability.static Jenkins
Gets theJenkins
singleton.Gets theItem
inside this group that has a given name, or null if it does not exist.final Item
Gets the item by its path name from the given contextfinal <T extends Item>
Tfinal <T extends Item>
TgetItemByFullName
(String fullName) <T extends Item>
TgetItemByFullName
(String fullName, Class<T> type) Gets theItem
object by its full name.Returns theItemGroup
from which the views in this group should render items.Returns the read-only view of all theTopLevelItem
s keyed by their names.getItems()
Gets just the immediate children ofJenkins
.<T> List<T>
Gets just the immediate children ofJenkins
but of the given type.getItems
(Predicate<TopLevelItem> pred) Gets just the immediate children ofJenkins
based on supplied predicate.Gets the JDK installation of the given name, or returns null.getJDKs()
getJnlpJars
(String fileName) Serves jar files for inbound agents.Gets the names of all theJob
s.getJobProperty
(String shortClassName) Gets theJobPropertyDescriptor
by name.Gets the label that exists on this system by the name.getLabelAtom
(String name) Returns the label atom of the given name.Gets all the active labels in the current system.Returns the manually configured label for a node.Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.getLog()
For bindingLogRecorderManager
to "/log".Gets the markup formatter used in the system.getMe()
Exposes the current user to/me
URL.getMode()
ReturnsNode.Mode.EXCLUSIVE
if this node is only available for those jobs that exclusively specifies this node as the assigned node.Gets the agent node of the give name, hooked under this Jenkins.Human-readable description of this node.Gets theNodeProperty
instances configured for thisNode
.getNodes()
int
Returns the number ofExecutor
s.getOrLoadNode
(String nodeName) <P extends Plugin>
PGets the plugin object from its class.Gets the plugin object from its short name.getPlugins
(Class<P> clazz) Gets the plugin objects from their super-class.Returns the primaryView
that renders the top-page of Jenkins.The strategy used to check the project names.Deprecated.This method will ignore Maven and matrix projects, as well as projects inside containers such as folders.getProxy()
Retrieve the proxy configuration.getPublisher
(String shortClassName) Gets the publisher descriptor by name.getQueue()
Returns quiet down reason if it was indicated.int
Gets the system default quiet period.getRepositoryBrowser
(String shortClassName) Gets the repository browser descriptor by name.getRetentionStrategy
(String shortClassName) Gets the retention strategy descriptor by name.Gets the root directory on the file system that thisItem
can use freely for storing the configuration data.getRootDirFor
(TopLevelItem child) Assigns theroot directory
for children.Gets the root directory of this node.Gets the absolute URL of Jenkins, such ashttp://localhost/jenkins/
.Gets the absolute URL of Jenkins top page, such ashttp://localhost/jenkins/
.Gets the SCM descriptor by name.int
Gets the global SCM check out retry count.Deprecated.UseSCMListener.all()
instead.Returns the URL of this item relative to the parentSearchItem
.Deprecated.Due to the past security advisory, this value should not be used any more to protect sensitive information.Deprecated.SeegetSecretKey()
.Returns the constant that captures the three basic security modes in Jenkins.getSecurityRealms
(String shortClassName) Gets theSecurityRealm
descriptors by name.Gets the special label that represents this node itself.jakarta.servlet.ServletContext
If set, a currently active setup wizard - e.g.int
Fallback to the primary view.static VersionNumber
Get the stored version of Jenkins, as stored bydoConfigSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)
.Synonym forgetDescription()
.Gets the names of all theTopLevelItem
s.getTrigger
(String shortClassName) Gets the trigger descriptor by name.Gets a list of unprotected root actions.Gets the URL token that prefixes the URLs for childItem
s.Gets the user of the given name.static VersionNumber
ParsesVERSION
intoVersionNumber
, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run
)Gets a view by the specified name.Returns actions that should be displayed in views.getViews()
Gets the read-only list of allView
s.Gets the TabBar for the views.Gets theWidget
s registered on this object.getWorkspaceFor
(TopLevelItem item) Returns a "workspace" directory for the givenTopLevelItem
.static boolean
Deprecated.boolean
If the configured buildsDir has it's default value or has been changed.boolean
If usage statistics has been disabledboolean
Returns if the quietingDown is a safe restart.boolean
Returns true if Jenkins is quieting down.boolean
Is Jenkins running in HTTPS? Note that we can't really trustServletRequest.isSecure()
because HTTPS might be terminated in the reverse proxy.boolean
boolean
isSubjectToMandatoryReadPermissionCheck
(String restOfPath) Test a path to see if it is subject to mandatory read permission checks by container-managed securityboolean
Returns true if the container initiated the termination of the web application.boolean
Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.boolean
If usage statistics are being collectedboolean
If true, all the POST requests to Jenkins would have to have crumb in it to protect Jenkins from CSRF vulnerabilities.boolean
boolean
A convenience method to check if there's some security restrictions in place.void
load()
Loads the state of this object from disk.void
static <T> T
Shortcut forJenkins.getInstanceOrNull()?.lookup.get(type)
Default implementation that returns empty index.void
onDeleted
(TopLevelItem item) Called in response toAbstractItem.doDoDelete(StaplerRequest2, StaplerResponse2)
void
onRenamed
(TopLevelItem job, String oldName, String newName) Called byJob.renameTo(String)
to update relevant data structure.void
onViewRenamed
(View view, String oldName, String newName) View
calls this method when it's renamed.void
putItem
(TopLevelItem item) Overwrites the existing item by new one.protected Object
Maintains backwards compatibility.void
Rebuilds the dependency map.Rebuilds the dependency map asynchronously.void
RefreshExtensionList
s by adding all the newly discovered extensions.void
reload()
Reloads the configuration synchronously.void
remove
(TopLevelItem item) Removes an item from this group.void
removeNode
(Node n) Removes aNode
from Jenkins.void
restart()
Performs a restart.void
Deprecated.usesafeRestart(String)
instead.void
safeRestart
(String message) Queues up a restart to be performed once there are no builds currently running.void
save()
Save the settings to a file.void
setAgentProtocols
(Set<String> protocols) Deprecated.No longer does anything.void
Sets a new authorization strategy.void
setCrumbIssuer
(CrumbIssuer issuer) void
setDisableRememberMe
(boolean disableRememberMe) void
setInstallState
(InstallState newState) Update the current install state.void
setJDKs
(Collection<? extends JDK> jdks) Replaces all JDK installations with those from the given collection.void
setLabelString
(String label) Sets the label string for a node.void
setLog
(LogRecorderManager log) Set the LogRecorderManager.void
Sets the markup formatter used in the system globally.void
void
setMyViewsTabBar
(MyViewsTabBar myViewsTabBar) void
setNodeName
(String name) void
void
setNoUsageStatistics
(Boolean noUsageStatistics) Sets the noUsageStatistics flagvoid
setNumExecutors
(int n) Sets a number of executors.void
void
void
setProxy
(ProxyConfiguration proxy) Set the proxy configuration.void
setQuietPeriod
(Integer quietPeriod) Sets the global quiet period.void
setRawBuildsDir
(String buildsDir) void
setScmCheckoutRetryCount
(int scmCheckoutRetryCount) void
setSecurityRealm
(SecurityRealm securityRealm) Sets a security realm.void
setSlaveAgentPort
(int port) void
setSystemMessage
(String message) Sets the system message.void
setViews
(Collection<View> views) Completely replaces views.void
setViewsTabBar
(ViewsTabBar viewsTabBar) boolean
tryGetLabelAtom
(String name) Returns the label atom of the given name, only if it already exists.void
unloadNode
(Node n) Unload a node from Jenkins without touching its configuration file.protected void
protected void
boolean
updateNode
(Node n) Saves an existingNode
on disk, called byNode.save()
.Methods inherited from class hudson.model.AbstractCIBase
getDisabledAdministrativeMonitors, getNodeName, getUrl, interruptReloadThread, killComputer, resetLabel, setDisabledAdministrativeMonitors, setViewOwner, updateComputerList, updateNewComputer
Methods inherited from class hudson.model.Node
canTake, canTake, getAssignedLabels, getChannel, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getTemporaryOfflineCause, isAcceptingTasks, isHoldOffLaunchUntilSave, onLoad, reconfigure, reconfigure, toComputer
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
Methods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getItemName, getItemsStream, getItemsStream, getUrl
Methods inherited from interface jenkins.model.ModelObjectWithChildren
doChildrenContextMenu
Methods inherited from interface jenkins.model.ModelObjectWithContextMenu
doContextMenu
Methods inherited from interface hudson.model.ModifiableItemGroup
doCreateItem
Methods inherited from interface hudson.search.SearchItem
getSearchIcon
Methods inherited from interface hudson.model.ViewGroup
getAllViews, getUrl
-
Field Details
-
lookup
Stores various objects scoped toJenkins
. -
root
Root directory of the system. -
computers
Computer
s in this Jenkins system. Read-only. -
clouds
ActiveCloud
s. -
slaves
Deprecated.in favour ofNodes
Legacy store of the set of installed cluster nodes. -
pluginManager
Loaded plugins. -
tcpSlaveAgentListener
-
overallLoad
Load statistics of the entire system. This includes every executor and every job in the system. -
unlabeledLoad
Load statistics of the free roaming jobs and agents. This includes all executors onNode.Mode.NORMAL
nodes and jobs that do not have any assigned nodes.- Since:
- 1.467
-
unlabeledNodeProvisioner
NodeProvisioner
that reacts tounlabeledLoad
.- Since:
- 1.467
-
overallNodeProvisioner
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public final transient NodeProvisioner overallNodeProvisionerDeprecated.as of 1.467 UseunlabeledNodeProvisioner
. This was broken because it was tracking all the executors in the system, but it was only tracking free-roaming jobs in the queue. SoCloud
fails to launch nodes when you have some exclusive agents and free-roaming jobs in the queue. -
servletContext
Deprecated. -
administrativeMonitors
AdministrativeMonitor
s installed on this system.- See Also:
-
proxy
HTTP proxy configuration. -
ALLOWED_RESOURCE_EXTENSIONS
Extension list thatdoResources(StaplerRequest2, StaplerResponse2)
can serve. This set is mutable to allow plugins to add additional extensions. -
logRecords
Live view of recentLogRecord
s produced by Jenkins. -
XSTREAM
public static final com.thoughtworks.xstream.XStream XSTREAMThread-safe reusableXStream
. -
XSTREAM2
-
UNCOMPUTED_VERSION
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String UNCOMPUTED_VERSIONThe version number before it is "computed" (by a call to computeVersion()).- Since:
- 2.0
- See Also:
-
VERSION
Version number of this Jenkins. -
CHANGELOG_URL
-
VERSION_HASH
Hash ofVERSION
. -
SESSION_HASH
Unique random token that identifies the current session. Used to makeRESOURCE_PATH
unique so that we can set long "Expires" header. We used to useVERSION_HASH
, but making this session local allows us to reuse the sameRESOURCE_PATH
for static resources in plugins. -
RESOURCE_PATH
Prefix to static resources like images and javascripts in the war file. Either "" or strings like "/static/VERSION", which avoids Jenkins to pick up stale cache when the user upgrades to a different version.Value computed in
WebAppMain
. -
VIEW_RESOURCE_PATH
Prefix to resources alongside view scripts. Strings like "/resources/VERSION", which avoids Jenkins to pick up stale cache when the user upgrades to a different version.Value computed in
WebAppMain
. -
PARALLEL_LOAD
public static boolean PARALLEL_LOAD -
KILL_AFTER_LOAD
public static boolean KILL_AFTER_LOAD -
FLYWEIGHT_SUPPORT
Deprecated.No longer used. -
CONCURRENT_BUILD
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public static boolean CONCURRENT_BUILDDeprecated.as of 1.464 This flag will have no effect.Tentative switch to activate the concurrent build behavior. When we merge this back to the trunk, this allows us to keep this feature hidden for a while until we iron out the kinks.- See Also:
-
NAME_VALIDATION_REJECTS_TRAILING_DOT_PROP
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String NAME_VALIDATION_REJECTS_TRAILING_DOT_PROPName of the system property escape hatch for SECURITY-2424. It allows to have back the legacy (and vulnerable) behavior allowing a "good name" to end with a dot. This could be used to exploit two names colliding in the file system to extract information. The files ending with a dot are only a problem on Windows. The default value is true. For detailed documentation: Support for Whitespace characters in File and Folder names for Windows- See Also:
-
AUTOMATIC_AGENT_LAUNCH
public static boolean AUTOMATIC_AGENT_LAUNCHAutomatically try to launch an agent when Jenkins is initialized or a new agent computer is created. -
EXTEND_TIMEOUT_SECONDS
public static int EXTEND_TIMEOUT_SECONDSThe amount of time by which to extend the startup notification timeout as each initialization milestone is attained. -
PERMISSIONS
-
ADMINISTER
-
MANAGE
This permission grants access to parts of the Jenkins system configuration.Only features that won't have an impact on Jenkins' overall security and stability should have their permission requirement lowered from
ADMINISTER
toMANAGE
. For example, many scripting and code execution features (e.g., configuring master agents, paths to tools on master, etc.) are unsafe to make available to users with only this permission, as they could be used to bypass permission enforcement and elevate permissions.This permission is disabled by default and support for it considered experimental. Administrators can set the system property
jenkins.security.ManagePermission
to enable it.- Since:
- 2.222
-
SYSTEM_READ
Allows read-only access to large parts of the system configuration. When combined withMANAGE
, it is expected that everything is shown as if onlySYSTEM_READ
was granted, but that only options editable by users withMANAGE
are editable. -
MANAGE_AND_SYSTEM_READ
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final Permission[] MANAGE_AND_SYSTEM_READ -
READ
-
RUN_SCRIPTS
Deprecated.in Jenkins 2.222 useADMINISTER
instead -
ANONYMOUS2
public static final org.springframework.security.core.Authentication ANONYMOUS2Authentication
object that represents the anonymous user. Because Spring Security creates its ownAnonymousAuthenticationToken
instances, the code must not expect the singleton semantics. This is just a convenient instance.- Since:
- 2.266
-
ANONYMOUS
Deprecated.useANONYMOUS2
- Since:
- 1.343
-
-
Constructor Details
-
Jenkins
protected Jenkins(File root, jakarta.servlet.ServletContext context) throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorException - Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException
-
Jenkins
protected Jenkins(File root, jakarta.servlet.ServletContext context, PluginManager pluginManager) throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorException - Parameters:
pluginManager
- If non-null, use existing plugin manager. create a new one.- Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException
-
-
Method Details
-
loadNode
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public void loadNode(File dir) throws IOException - Throws:
IOException
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Since:
- 2.475
-
get
Gets theJenkins
singleton.- Returns:
Jenkins
instance- Throws:
IllegalStateException
- for the reasons thatgetInstanceOrNull()
might return null- Since:
- 2.98
-
getActiveInstance
Deprecated.This is a verbose historical alias forget()
.- Throws:
IllegalStateException
- Since:
- 1.590
-
getInstanceOrNull
Gets theJenkins
singleton.get()
is what you normally want.In certain rare cases you may have code that is intended to run before Jenkins starts or while Jenkins is being shut down. For those rare cases use this method.
In other cases you may have code that might end up running on a remote JVM and not on the Jenkins controller or built-in node. For those cases you really should rewrite your code so that when the
Callable
is sent over the remoting channel it can do whatever it needs without ever referring toJenkins
; for example, gather any information you need on the controller side before constructing the callable. If you must do a runtime check whether you are in the controller or agent, useJenkinsJVM
rather than this method, as merely loading theJenkins
class file into an agent JVM can cause linkage errors under some conditions.- Returns:
- The instance. Null if the
Jenkins
service has not been started, or was already shut down, or we are running on an unrelated JVM, typically an agent. - Since:
- 1.653
-
getInstance
Deprecated.This is a historical alias forgetInstanceOrNull()
but with ambiguous nullability. Useget()
in typical cases. -
readResolve
Maintains backwards compatibility. Invoked by XStream when this object is de-serialized. -
getProxy
Retrieve the proxy configuration.- Returns:
- the proxy configuration
- Since:
- 2.205
-
setProxy
Set the proxy configuration.- Parameters:
proxy
- the proxy to set- Since:
- 2.205
-
getInstallState
Get the Jenkinsinstall state
.- Returns:
- The Jenkins
install state
.
-
setInstallState
Update the current install state. This will invoke state.initializeState() when the state has been transitioned. -
getTcpSlaveAgentListener
-
getAdjuncts
MakesAdjunctManager
URL-bound. The dummy parameter allows us to use different URLs for the same adjunct, for proper cache handling. -
getSlaveAgentPort
@Exported public int getSlaveAgentPort() -
isSlaveAgentPortEnforced
public boolean isSlaveAgentPortEnforced()- Since:
- 2.24
-
setSlaveAgentPort
- Parameters:
port
- 0 to indicate random available TCP port. -1 to disable this service.- Throws:
IOException
-
getAgentProtocols
Returns the enabled agent protocols.- Returns:
- the enabled agent protocols.
- Since:
- 2.16
-
setAgentProtocols
Deprecated.No longer does anything. -
setNodeName
Description copied from class:Node
When the user clones aNode
, Hudson uses this method to change the node name right after the clonedNode
object is instantiated.This method is never used for any other purpose, and as such for all practical intents and purposes, the node name should be treated like immutable.
- Specified by:
setNodeName
in classNode
-
getNodeDescription
Description copied from class:Node
Human-readable description of this node.- Specified by:
getNodeDescription
in classNode
-
getDescription
-
getPluginManager
-
getUpdateCenter
-
isNoUsageStatistics
If usage statistics has been disabled- Since:
- 2.226
-
isUsageStatisticsCollected
public boolean isUsageStatisticsCollected()If usage statistics are being collected- Returns:
true
if usage statistics should be collected. Defaults totrue
whennoUsageStatistics
is not set.
-
setNoUsageStatistics
Sets the noUsageStatistics flag- Throws:
IOException
-
getApi
-
getSecretKey
Deprecated.Due to the past security advisory, this value should not be used any more to protect sensitive information. SeeConfidentialStore
andConfidentialKey
for how to store secrets.Returns a secret key that survives across container start/stop.This value is useful for implementing some of the security features.
-
getSecretKeyAsAES128
Deprecated.SeegetSecretKey()
.Gets the secret key as a key for AES-128.- Since:
- 1.308
-
getLegacyInstanceId
Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.This form of identifier is weak in that it can be impersonated by others. See the Instance Identity plugin for more modern form of instance ID that can be challenged and verified.
- Since:
- 1.498
-
getScm
Gets the SCM descriptor by name. Primarily used for making them web-visible. -
getRepositoryBrowser
Gets the repository browser descriptor by name. Primarily used for making them web-visible. -
getBuilder
Gets the builder descriptor by name. Primarily used for making them web-visible. -
getBuildWrapper
Gets the build wrapper descriptor by name. Primarily used for making them web-visible. -
getPublisher
Gets the publisher descriptor by name. Primarily used for making them web-visible. -
getTrigger
Gets the trigger descriptor by name. Primarily used for making them web-visible. -
getRetentionStrategy
Gets the retention strategy descriptor by name. Primarily used for making them web-visible. -
getJobProperty
Gets theJobPropertyDescriptor
by name. Primarily used for making them web-visible. -
getComputer
Deprecated.UI method. Not meant to be used programmatically. -
getCloud
Only there to bind to /cloud/ URL. Otherwise /cloud/new gets resolved to getCloud("new") by stapler which is not what we want. -
getDescriptor
ExposesDescriptor
by its name to URL. After doing all thegetXXX(shortClassName)
methods, I finally realized that this just doesn't scale.- Parameters:
id
- EitherDescriptor.getId()
(recommended) or the short name of aDescribable
subtype (for compatibility)- Throws:
IllegalArgumentException
- if a short name was passed which matches multiple IDs (fail fast)
-
getDescriptorByName
Alias forgetDescriptor(String)
.- Specified by:
getDescriptorByName
in interfaceDescriptorByNameOwner
- Parameters:
id
- EitherDescriptor.getId()
(recommended) or the short name.
-
getDescriptor
Gets theDescriptor
that corresponds to the givenDescribable
type.If you have an instance of
type
and callDescribable.getDescriptor()
, you'll get the same instance that this method returns. -
getDescriptorOrDie
Works just likegetDescriptor(Class)
but don't take no for an answer.- Throws:
AssertionError
- If the descriptor is missing.- Since:
- 1.326
-
getDescriptorByType
Gets theDescriptor
instance in the current Jenkins by its type. -
getSecurityRealms
Gets theSecurityRealm
descriptors by name. Primarily used for making them web-visible. -
updateNewComputer
-
updateComputerList
protected void updateComputerList() -
getSCMListeners
Deprecated.UseSCMListener.all()
instead. -
getPlugin
Gets the plugin object from its short name. This allows URLhudson/plugin/ID
to be served by the views of the plugin class.- Parameters:
shortName
- Short name of the plugin- Returns:
- The plugin singleton or
null
if for some reason the plugin is not loaded. The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. UsePlugin.getWrapper()
and thenPluginWrapper.isActive()
to check it.
-
getPlugin
Gets the plugin object from its class.This allows easy storage of plugin information in the plugin singleton without every plugin reimplementing the singleton pattern.
- Type Parameters:
P
- Class of the plugin- Parameters:
clazz
- The plugin class (beware class-loader fun, this will probably only work from within the jpi that defines the plugin class, it may or may not work in other cases)- Returns:
- The plugin singleton or
null
if for some reason the plugin is not loaded. The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. UsePlugin.getWrapper()
and thenPluginWrapper.isActive()
to check it.
-
getPlugins
Gets the plugin objects from their super-class.- Parameters:
clazz
- The plugin class (beware class-loader fun)- Returns:
- The plugin instances.
-
getSystemMessage
Synonym forgetDescription()
. -
getMarkupFormatter
Gets the markup formatter used in the system.- Returns:
- never null.
- Since:
- 1.391
-
setMarkupFormatter
Sets the markup formatter used in the system globally.- Since:
- 1.391
-
setSystemMessage
Sets the system message.- Throws:
IOException
-
getFederatedLoginService
-
getFederatedLoginServices
-
createLauncher
Description copied from class:Node
Returns aLauncher
for executing programs on this node.The callee must call
Launcher.decorateFor(Node)
before returning to complete the decoration.- Specified by:
createLauncher
in classNode
-
getFullName
Description copied from interface:ItemGroup
Gets the full name of thisItemGroup
.- Specified by:
getFullName
in interfaceItemGroup<TopLevelItem>
- See Also:
-
getFullDisplayName
- Specified by:
getFullDisplayName
in interfaceItemGroup<TopLevelItem>
- See Also:
-
getActions
Returns the transientAction
s associated with the top page.Adding
Action
is primarily useful for plugins to contribute an item to the navigation bar of the top page. See existingAction
implementation for it affects the GUI.To register an
Action
, implementRootAction
extension point, or write code likeJenkins.get().getActions().add(...)
.- Returns:
- Live list where the changes can be made. Can be empty but never null.
- Since:
- 1.172
-
getItems
Gets just the immediate children ofJenkins
.- Specified by:
getItems
in interfaceItemGroup<TopLevelItem>
- See Also:
-
getItems
Gets just the immediate children ofJenkins
based on supplied predicate.- Specified by:
getItems
in interfaceItemGroup<TopLevelItem>
- Since:
- 2.221
- See Also:
-
getItemMap
Returns the read-only view of all theTopLevelItem
s keyed by their names.This method is efficient, as it doesn't involve any copying.
- Since:
- 1.296
-
getItems
Gets just the immediate children ofJenkins
but of the given type. -
getProjects
Deprecated.This method will ignore Maven and matrix projects, as well as projects inside containers such as folders. You may prefer to callItemGroup.getAllItems(Class)
onAbstractProject
, perhaps also usingUtil.createSubList(java.util.Collection<?>, java.lang.Class<T>)
to consider onlyTopLevelItem
s. (That will also consider the caller's permissions.) If you really want to get justProject
s at top level, ignoring permissions, you can filter the values fromgetItemMap()
usingUtil.createSubList(java.util.Collection<?>, java.lang.Class<T>)
.Gets a list of simple top-level projects. -
getJobNames
Gets the names of all theJob
s. -
doFillJobNameItems
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public ComboBoxModel doFillJobNameItems() -
getViewActions
Description copied from interface:ViewGroup
Returns actions that should be displayed in views.In this interface, the return value is used read-only. This doesn't prevent subtypes from returning modifiable actions, however.
- Specified by:
getViewActions
in interfaceViewGroup
- Returns:
- may be empty but never null;
getActions()
by default - See Also:
-
getTopLevelItemNames
Gets the names of all theTopLevelItem
s. -
getView
Gets a view by the specified name. The method iterates throughViewGroup
s if required. -
getViews
Gets the read-only list of allView
s. -
addView
Description copied from interface:ModifiableViewGroup
- Specified by:
addView
in interfaceModifiableViewGroup
- Throws:
IOException
-
setViews
Completely replaces views.This operation is NOT provided as an atomic operation, but rather the sole purpose of this is to define a setter for this to help introspecting code, such as system-config-dsl plugin
- Throws:
IOException
-
canDelete
Description copied from interface:ViewGroup
Determine whether a view may be deleted. -
deleteView
Description copied from interface:ViewGroup
Deletes a view in this group.- Specified by:
deleteView
in interfaceViewGroup
- Throws:
IOException
-
onViewRenamed
Description copied from interface:ViewGroup
View
calls this method when it's renamed. This method is intended to work as a notification to theViewGroup
(so that it can adjust its internal data structure, for example.)It is the caller's responsibility to ensure that the new name is a legal view name.
- Specified by:
onViewRenamed
in interfaceViewGroup
-
getPrimaryView
Returns the primaryView
that renders the top-page of Jenkins.- Specified by:
getPrimaryView
in interfaceViewGroup
- Returns:
- by default, null
-
setPrimaryView
-
getViewsTabBar
Description copied from interface:ViewGroup
Gets the TabBar for the views. TabBar for views can be provided by extension. Only one TabBar can be active at a given time (Selectable by user in the global Configuration page). Default TabBar is provided by Hudson Platform.- Specified by:
getViewsTabBar
in interfaceViewGroup
-
setViewsTabBar
-
getItemGroup
Description copied from interface:ViewGroup
Returns theItemGroup
from which the views in this group should render items.Generally speaking, Views render a subset of
TopLevelItem
s that belong to this item group.- Specified by:
getItemGroup
in interfaceViewGroup
- Returns:
- Never null. Sometimes this is
ModifiableItemGroup
(if the container allows arbitrary addition). By default,get()
.
-
getMyViewsTabBar
-
setMyViewsTabBar
-
isUpgradedFromBefore
Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.This method continues to return true until the system configuration is saved, at which point
version
will be overwritten and Jenkins forgets the upgrade history.To handle SNAPSHOTS correctly, pass in "1.N.*" to test if it's upgrading from the version equal or younger than N. So say if you implement a feature in 1.301 and you want to check if the installation upgraded from pre-1.301, pass in "1.300.*"
- Since:
- 1.301
-
getComputers
Gets the read-only list of allComputer
s. -
getComputer
-
getLabel
Gets the label that exists on this system by the name.- Returns:
- null if name is null.
- See Also:
-
getLabelAtom
Returns the label atom of the given name.- Returns:
- non-null iff name is non-null
-
tryGetLabelAtom
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Nullable public LabelAtom tryGetLabelAtom(@NonNull String name) Returns the label atom of the given name, only if it already exists.- Returns:
- non-null if the label atom already exists.
-
getLabels
Gets all the active labels in the current system. -
getLabelAtomSet
- Overrides:
getLabelAtomSet
in classNode
- Returns:
- An immutable set of LabelAtom associated with the current node label.
-
getLabelAtoms
-
getQueue
- Specified by:
getQueue
in classAbstractCIBase
-
getDisplayName
- Specified by:
getDisplayName
in interfaceModelObject
- Overrides:
getDisplayName
in classNode
-
getJDKs
-
setJDKs
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void setJDKs(Collection<? extends JDK> jdks) Replaces all JDK installations with those from the given collection. UseJDK.DescriptorImpl.setInstallations(JDK...)
to set JDK installations from external code. -
getJDK
Gets the JDK installation of the given name, or returns null. -
getNode
Gets the agent node of the give name, hooked under this Jenkins. -
getOrLoadNode
-
getCloud
-
getComputerMap
- Specified by:
getComputerMap
in classAbstractCIBase
-
getComputersCollection
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Collection<Computer> getComputersCollection()- Returns:
- the collection of all
Computer
s in this instance.
-
getNodes
Returns allNode
s in the system, excludingJenkins
instance itself which represents the built-in node (in other words, this only returns agents).- Specified by:
getNodes
in classAbstractCIBase
-
getNodesObject
- Returns:
- The Nodes object.
-
addNode
Adds one moreNode
to Jenkins. If a node of the same name already exists then that node will be replaced.- Throws:
IOException
-
removeNode
Removes aNode
from Jenkins.- Throws:
IOException
-
unloadNode
Unload a node from Jenkins without touching its configuration file. -
updateNode
Saves an existingNode
on disk, called byNode.save()
. This method is preferred in those cases where you need to determine atomically that the node being saved is actually in the list of nodes.- Parameters:
n
- the node to be updated.- Returns:
true
, if the node was updated.false
, if the node was not in the list of nodes.- Throws:
IOException
- if the node could not be persisted.- Since:
- 1.634
- See Also:
-
setNodes
- Throws:
IOException
-
getNodeProperties
Description copied from class:Node
Gets theNodeProperty
instances configured for thisNode
.- Specified by:
getNodeProperties
in classNode
-
getGlobalNodeProperties
-
getAdministrativeMonitor
BindsAdministrativeMonitor
s to URL.- Parameters:
id
- Monitor ID- Returns:
- The requested monitor or
null
if it does not exist
-
getActiveAdministrativeMonitors
Returns the enabled and activated administrative monitors accessible to the current user.- Since:
- 2.64
-
getDescriptor
Description copied from interface:Describable
Gets the descriptor for this instance.Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<Node>
- Specified by:
getDescriptor
in classNode
-
getQuietPeriod
public int getQuietPeriod()Gets the system default quiet period. -
setQuietPeriod
Sets the global quiet period.- Parameters:
quietPeriod
- null to the default value.- Throws:
IOException
-
getScmCheckoutRetryCount
public int getScmCheckoutRetryCount()Gets the global SCM check out retry count. -
setScmCheckoutRetryCount
- Throws:
IOException
-
getSearchUrl
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Specified by:
getSearchUrl
in interfaceSearchItem
- Overrides:
getSearchUrl
in classNode
- Returns:
- URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
-
makeSearchIndex
Description copied from class:AbstractModelObject
Default implementation that returns empty index.- Overrides:
makeSearchIndex
in classAbstractModelObject
-
getUrlChildPrefix
Description copied from interface:ItemGroup
Gets the URL token that prefixes the URLs for childItem
s. Like "job", "item", etc.- Specified by:
getUrlChildPrefix
in interfaceItemGroup<TopLevelItem>
-
getRootUrl
Gets the absolute URL of Jenkins, such ashttp://localhost/jenkins/
.This method first tries to use the manually configured value, then fall back to
getRootUrlFromRequest()
. It is done in this order so that it can work correctly even in the face of a reverse proxy.- Returns:
null
if this parameter is not configured by the user and the calling thread is not in an HTTP request; otherwise the returned URL will always have the trailing/
- Throws:
IllegalStateException
-JenkinsLocationConfiguration
cannot be retrieved. Jenkins instance may be not ready, or there is an extension loading glitch.- Since:
- 1.66
- See Also:
-
getConfiguredRootUrl
@Exported(name="url") @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @CheckForNull public String getConfiguredRootUrl()Exported alias forJenkinsLocationConfiguration.getUrl()
. -
isRootUrlSecure
public boolean isRootUrlSecure()Is Jenkins running in HTTPS? Note that we can't really trustServletRequest.isSecure()
because HTTPS might be terminated in the reverse proxy. -
getRootUrlFromRequest
Gets the absolute URL of Jenkins top page, such ashttp://localhost/jenkins/
.Unlike
getRootUrl()
, which uses the manually configured value, this one uses the current request to reconstruct the URL. The benefit is that this is immune to the configuration mistake (users often fail to set the root URL correctly, especially when a migration is involved), but the downside is that unless you are processing a request, this method doesn't work.Please note that this will not work in all cases if Jenkins is running behind a reverse proxy which has not been fully configured. Specifically the
Host
andX-Forwarded-Proto
headers must be set. Reverse proxy - Apache shows some examples of configuration.- Since:
- 1.263
-
getRootDir
Description copied from interface:PersistenceRoot
Gets the root directory on the file system that thisItem
can use freely for storing the configuration data.This parameter is given by the
ItemGroup
whenItem
is loaded from memory.- Specified by:
getRootDir
in interfacePersistenceRoot
- Overrides:
getRootDir
in classNode
-
getWorkspaceFor
Description copied from class:Node
Returns a "workspace" directory for the givenTopLevelItem
.Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.
- Specified by:
getWorkspaceFor
in classNode
- Returns:
- null if this node is not connected hence the path is not available
-
getBuildDirFor
-
isDefaultBuildDir
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isDefaultBuildDir()If the configured buildsDir has it's default value or has been changed.- Returns:
- true if default value.
-
expandVariablesForDirectory
-
getRawWorkspaceDir
-
getRawBuildsDir
-
setRawBuildsDir
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void setRawBuildsDir(String buildsDir) -
getRootPath
Description copied from class:Node
Gets the root directory of this node.Hudson always owns a directory on every node. This method returns that.
- Specified by:
getRootPath
in classNode
- Returns:
- null if the node is offline and hence the
FilePath
object is not available.
-
createPath
Description copied from class:Node
Gets theFilePath
on this node.- Overrides:
createPath
in classNode
-
getClockDifference
Description copied from class:Node
Estimates the clock difference with this agent.- Overrides:
getClockDifference
in classNode
- Returns:
- always non-null.
-
getClockDifferenceCallable
Description copied from class:Node
Returns aCallable
that when run on the channel, estimates the clock difference.- Specified by:
getClockDifferenceCallable
in classNode
- Returns:
- always non-null.
-
getLog
For bindingLogRecorderManager
to "/log". Everything below here is admin-only, so do the check here. -
setLog
Set the LogRecorderManager.- Parameters:
log
- the LogRecorderManager to set- Since:
- 2.323
-
isUseSecurity
@Exported public boolean isUseSecurity()A convenience method to check if there's some security restrictions in place. -
isUseProjectNamingStrategy
public boolean isUseProjectNamingStrategy() -
isUseCrumbs
@Exported public boolean isUseCrumbs()If true, all the POST requests to Jenkins would have to have crumb in it to protect Jenkins from CSRF vulnerabilities. -
getSecurity
Returns the constant that captures the three basic security modes in Jenkins. -
getSecurityRealm
- Returns:
- never null.
-
setSecurityRealm
Sets a security realm.- Parameters:
securityRealm
- Security realm to set. Ifnull
,SecurityRealm.NO_AUTHENTICATION
will be set.
-
setAuthorizationStrategy
Sets a new authorization strategy.- Parameters:
a
- Authorization strategy to set. Ifnull
,AuthorizationStrategy.UNSECURED
will be set
-
isDisableRememberMe
public boolean isDisableRememberMe() -
setDisableRememberMe
public void setDisableRememberMe(boolean disableRememberMe) -
disableSecurity
public void disableSecurity() -
setProjectNamingStrategy
-
getLifecycle
-
getInjector
@CheckForNull public com.google.inject.Injector getInjector()Gets the dependency injection container that hosts all the extension implementations and other components in Jenkins.- Since:
- 1.433
-
getExtensionList
ReturnsExtensionList
that retains the discovered instances for the given extension type.- Parameters:
extensionType
- The base type that represents the extension point. NormallyExtensionPoint
subtype but that's not a hard requirement.- Returns:
- Can be an empty list but never null.
- See Also:
-
getExtensionList
@StaplerDispatchable public ExtensionList getExtensionList(String extensionType) throws ClassNotFoundException Used to bindExtensionList
s to URLs.- Throws:
ClassNotFoundException
- Since:
- 1.349
-
getDescriptorList
@NonNull public <T extends Describable<T>,D extends Descriptor<T>> DescriptorExtensionList<T,D> getDescriptorList(Class<T> type) ReturnsExtensionList
that retains the discoveredDescriptor
instances for the given kind ofDescribable
.- Returns:
- Can be an empty list but never null.
-
refreshExtensions
RefreshExtensionList
s by adding all the newly discovered extensions. Exposed only forPluginManager.dynamicLoad(File)
.- Throws:
ExtensionRefreshException
-
getACL
Returns the rootACL
.- Specified by:
getACL
in interfaceAccessControlled
- Overrides:
getACL
in classNode
- Returns:
- never null.
- See Also:
-
getAuthorizationStrategy
- Returns:
- never null.
-
getProjectNamingStrategy
The strategy used to check the project names.- Returns:
- never
null
-
isQuietingDown
@Exported public boolean isQuietingDown()Returns true if Jenkins is quieting down.No further jobs will be executed unless it can be finished while other current pending builds are still in progress.
-
isPreparingSafeRestart
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public boolean isPreparingSafeRestart()Returns if the quietingDown is a safe restart.- Since:
- 2.414
-
getQuietDownReason
Returns quiet down reason if it was indicated.- Returns:
- Reason if it was indicated. null otherwise
- Since:
- 2.267
-
isTerminating
public boolean isTerminating()Returns true if the container initiated the termination of the web application. -
getInitLevel
Gets the initialization milestone that we've already reached.- Returns:
InitMilestone.STARTED
even if the initialization hasn't been started, so that this method never returns null.
-
setNumExecutors
Sets a number of executors.- Parameters:
n
- Number of executors- Throws:
IOException
- Failed to save the configurationIllegalArgumentException
- Negative value has been passed
-
getItem
public TopLevelItem getItem(String name) throws org.springframework.security.access.AccessDeniedException Gets theItem
inside this group that has a given name, or null if it does not exist.. Note that the look up is case-insensitive.- Specified by:
getItem
in interfaceItemGroup<TopLevelItem>
- Returns:
- an item whose
Item.getName()
isname
and whoseItem.getParent()
isthis
, or null if there is no such item, or there is but the current user lacks bothItem.DISCOVER
andItem.READ
on it - Throws:
org.springframework.security.access.AccessDeniedException
- if the current user hasItem.DISCOVER
but notItem.READ
on this item
-
getItem
Gets the item by its path name from the given contextPath Names: If the name starts from '/', like "/foo/bar/zot", then it's interpreted as absolute. Otherwise, the name should be something like "foo/bar" and it's interpreted like relative path name in the file system is, against the given context.
For compatibility, as a fallback when nothing else matches, a simple path like
foo/bar
can also be treated withgetItemByFullName(java.lang.String, java.lang.Class<T>)
.- Parameters:
context
- null is interpreted asJenkins
. Base 'directory' of the interpretation.- Since:
- 1.406
-
getItem
-
getItem
-
getItem
-
getRootDirFor
Description copied from interface:ItemGroup
Assigns theroot directory
for children.- Specified by:
getRootDirFor
in interfaceItemGroup<TopLevelItem>
-
getItemByFullName
@CheckForNull public <T extends Item> T getItemByFullName(@NonNull String fullName, Class<T> type) throws org.springframework.security.access.AccessDeniedException Gets theItem
object by its full name. Full names are like path names, where each name ofItem
is combined by '/'.- Returns:
- null if either such
Item
doesn't exist under the given full name, or it exists but it's no an instance of the given type. - Throws:
org.springframework.security.access.AccessDeniedException
- as perItemGroup.getItem(java.lang.String)
-
getItemByFullName
-
getUser
Gets the user of the given name.- Returns:
- the user of the given name (which may or may not be an id), if that person exists; else null
- See Also:
-
createProject
@NonNull public TopLevelItem createProject(@NonNull TopLevelItemDescriptor type, @NonNull String name) throws IOException - Throws:
IOException
-
createProject
@NonNull public TopLevelItem createProject(@NonNull TopLevelItemDescriptor type, @NonNull String name, boolean notify) throws IOException Description copied from interface:ModifiableTopLevelItemGroup
Creates a new job.- Specified by:
createProject
in interfaceModifiableTopLevelItemGroup
- Parameters:
type
- Descriptor for job typename
- Name for jobnotify
- Whether to fire onCreated method for all ItemListeners- Throws:
IOException
-
putItem
Overwrites the existing item by new one.This is a short cut for deleting an existing job and adding a new one.
- Throws:
IOException
InterruptedException
-
createProject
@NonNull public <T extends TopLevelItem> T createProject(@NonNull Class<T> type, @NonNull String name) throws IOException Creates a new job.This version infers the descriptor from the type of the top-level item.
- Throws:
IllegalArgumentException
- if the project of the given name already exists.IOException
-
onRenamed
Called byJob.renameTo(String)
to update relevant data structure. assumed to be synchronized on Jenkins by the caller.- Specified by:
onRenamed
in interfaceItemGroup<TopLevelItem>
- Throws:
IOException
-
onDeleted
Called in response toAbstractItem.doDoDelete(StaplerRequest2, StaplerResponse2)
- Specified by:
onDeleted
in interfaceItemGroup<TopLevelItem>
- Throws:
IOException
-
canAdd
Description copied from interface:DirectlyModifiableTopLevelItemGroup
Returns true if a particular item may be added to this group.- Specified by:
canAdd
in interfaceDirectlyModifiableTopLevelItemGroup
- Parameters:
item
- an item currently elsewhere- Returns:
- true if
DirectlyModifiableTopLevelItemGroup.add(I, java.lang.String)
may be called with this item
-
add
public <I extends TopLevelItem> I add(I item, String name) throws IOException, IllegalArgumentException Description copied from interface:DirectlyModifiableTopLevelItemGroup
Adds an item to this group. UnlikeputItem(hudson.model.TopLevelItem)
this does not try to callItem.delete()
on an existing item, nor does it fireItemListener.onCreated(hudson.model.Item)
, nor check permissions. Normally you would callItem.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
after calling this method (the implementation is not expected to do so).- Specified by:
add
in interfaceDirectlyModifiableTopLevelItemGroup
- Type Parameters:
I
- the kind of item- Parameters:
item
- an item to add which is currently elsewherename
- the desired item name in this group (might simply be the originalItem.getName()
)- Returns:
- normally the same
item
, but might be a new copy if necessary - Throws:
IOException
- if adding failsIllegalArgumentException
- ifDirectlyModifiableTopLevelItemGroup.canAdd(hudson.model.TopLevelItem)
is false, or an item with this name already exists, or this item is as yet unnamed
-
remove
Description copied from interface:DirectlyModifiableTopLevelItemGroup
Removes an item from this group. UnlikeItemGroup.onDeleted(T)
this is not expected to fire any events.- Specified by:
remove
in interfaceDirectlyModifiableTopLevelItemGroup
- Parameters:
item
- an item which was part of this group- Throws:
IOException
- if removing failsIllegalArgumentException
- if this was not part of the group to begin with
-
getFingerprintMap
-
getFingerprint
- Throws:
IOException
-
_getFingerprint
Gets aFingerprint
object if it exists. Otherwise null.- Throws:
IOException
-
getConfigFile
The file we save our configuration.- Overrides:
getConfigFile
in classNode
-
getNumExecutors
public int getNumExecutors()Description copied from class:Node
Returns the number ofExecutor
s. This may be different fromgetExecutors().size()
because it takes time to adjust the number of executors.- Specified by:
getNumExecutors
in classNode
-
getMode
Description copied from class:Node
ReturnsNode.Mode.EXCLUSIVE
if this node is only available for those jobs that exclusively specifies this node as the assigned node. -
setMode
- Throws:
IOException
-
getLabelString
Description copied from class:Node
Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available viaNode.getAssignedLabels()
and includes all labels that have been manually configured. Mainly for form binding.- Specified by:
getLabelString
in classNode
-
setLabelString
Description copied from class:Node
Sets the label string for a node. This value will be returned byNode.getLabelString()
.- Overrides:
setLabelString
in classNode
- Parameters:
label
- The new label string to use.- Throws:
IOException
-
getSelfLabel
Description copied from class:Node
Gets the special label that represents this node itself.- Overrides:
getSelfLabel
in classNode
-
createComputer
Description copied from class:Node
Creates a newComputer
object that acts as the UI peer of thisNode
. Nobody butupdateComputerList()
should call this method.- Specified by:
createComputer
in classNode
- Returns:
- Created instance of the computer.
Can be
null
if theNode
implementation does not support it (e.g.Cloud
agent).
-
load
Description copied from interface:Loadable
Loads the state of this object from disk.- Specified by:
load
in interfaceLoadable
- Throws:
IOException
- The state could not be loaded.
-
save
Save the settings to a file.- Specified by:
save
in interfaceSaveable
- Overrides:
save
in classNode
- Throws:
IOException
- if the persistence failed.
-
cleanUp
public void cleanUp()Called to shut down the system. -
getDynamic
-
doConfigSubmit
@POST public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException Accepts submission from the configuration page.- Throws:
IOException
jakarta.servlet.ServletException
Descriptor.FormException
-
getCrumbIssuer
Gets theCrumbIssuer
currently in use.- Returns:
- null if none is in use.
-
setCrumbIssuer
-
doTestPost
public void doTestPost(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
doConfigExecutorsSubmit
@POST public void doConfigExecutorsSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException Accepts submission from the node configuration page.- Throws:
IOException
jakarta.servlet.ServletException
Descriptor.FormException
-
doSubmitDescription
public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Accepts the new description.- Throws:
IOException
jakarta.servlet.ServletException
-
doQuietDown
public org.kohsuke.stapler.HttpRedirect doQuietDown() -
doQuietDown
Deprecated.since 2.267; usedoQuietDown(boolean, int, String, boolean)
instead.Quiet down Jenkins - preparation for a restart Presented for compatibility.- Parameters:
block
- Block until the system really quiets down and no builds are runningtimeout
- If non-zero, only block up to the specified number of milliseconds
-
doQuietDown
@Deprecated(since="2.414") public org.kohsuke.stapler.HttpRedirect doQuietDown(boolean block, int timeout, @CheckForNull String message) throws InterruptedException, IOException Deprecated.usedoQuietDown(boolean, int, String, boolean)
instead.Quiet down Jenkins - preparation for a restart- Parameters:
block
- Block until the system really quiets down and no builds are runningtimeout
- If non-zero, only block up to the specified number of millisecondsmessage
- Quiet reason that will be visible to user- Throws:
InterruptedException
IOException
-
doQuietDown
public org.kohsuke.stapler.HttpRedirect doQuietDown(@QueryParameter boolean block, @QueryParameter int timeout, @QueryParameter @CheckForNull String message, @QueryParameter boolean safeRestart) throws InterruptedException, IOException Quiet down Jenkins - preparation for a restart- Parameters:
block
- Block until the system really quiets down and no builds are runningtimeout
- If non-zero, only block up to the specified number of millisecondsmessage
- Quiet reason that will be visible to usersafeRestart
- If the quietDown is for a safeRestart- Throws:
InterruptedException
IOException
- Since:
- 2.414
-
doCancelQuietDown
public org.kohsuke.stapler.HttpRedirect doCancelQuietDown()Cancel previous quiet down Jenkins - preparation for a restart -
doToggleCollapse
public org.kohsuke.stapler.HttpResponse doToggleCollapse() throws jakarta.servlet.ServletException, IOException- Throws:
jakarta.servlet.ServletException
IOException
-
doClassicThreadDump
public void doClassicThreadDump(org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Backward compatibility. Redirect to the thread dump.- Throws:
IOException
jakarta.servlet.ServletException
-
getAllThreadDumps
Obtains the thread dump of all agents (including the controller/built-in node.)Since this is for diagnostics, it has a built-in precautionary measure against hang agents.
- Throws:
IOException
InterruptedException
-
doCreateItem
public TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Description copied from interface:ModifiableItemGroup
The request format follows that of<n:form xmlns:n="/lib/form">
.- Specified by:
doCreateItem
in interfaceModifiableItemGroup<TopLevelItem>
- Throws:
IOException
jakarta.servlet.ServletException
-
createProjectFromXML
Description copied from interface:ModifiableTopLevelItemGroup
Creates a new job from its configuration XML. The type of the job created will be determined by what's in this XML.- Specified by:
createProjectFromXML
in interfaceModifiableTopLevelItemGroup
- Parameters:
name
- Name of the newly created project.xml
- Item configuration as xml- Returns:
- Newly created
TopLevelItem
. - Throws:
IOException
- Since:
- 1.319
-
copy
Description copied from interface:ModifiableTopLevelItemGroup
Copies a job.- Specified by:
copy
in interfaceModifiableTopLevelItemGroup
- Parameters:
src
- ATopLevelItem
to be copied.name
- Name of the newly created project.- Returns:
- Newly created
TopLevelItem
. - Throws:
IOException
-
copy
- Throws:
IOException
-
doCreateView
@POST public void doCreateView(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException - Throws:
IOException
jakarta.servlet.ServletException
Descriptor.FormException
-
checkGoodName
Check if the given name is suitable as a name for job, view, etc.- Throws:
Failure
- if the given name is not good
-
doSecured
public void doSecured(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Checks if the user was successfully authenticated.- Throws:
IOException
jakarta.servlet.ServletException
- See Also:
-
doLoginEntry
public void doLoginEntry(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Called once the user logs in. Just forward to the top page. Used only byLegacySecurityRealm
.- Throws:
IOException
-
doLogout
public void doLogout(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Logs out the user.- Throws:
IOException
jakarta.servlet.ServletException
- Since:
- 2.475
-
doLogout
@Deprecated @StaplerNotDispatchable public void doLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOException
javax.servlet.ServletException
-
getJnlpJars
Serves jar files for inbound agents. -
doJnlpJars
-
doReload
Reloads the configuration.- Throws:
IOException
-
reload
public void reload() throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorExceptionReloads the configuration synchronously. Beware that this calls neitherItemListener.onLoaded()
norInitializer
s.- Throws:
IOException
InterruptedException
org.jvnet.hudson.reactor.ReactorException
-
doDoFingerprintCheck
public void doDoFingerprintCheck(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Do a finger-print check.- Throws:
IOException
jakarta.servlet.ServletException
-
doGc
For debugging. Expose URL to perform GC.- Throws:
IOException
-
doException
@StaplerDispatchable public void doException()End point that intentionally throws an exception to test the error behaviour.- Since:
- 1.467
-
doContextMenu
public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws IOException, org.apache.commons.jelly.JellyException Description copied from interface:ModelObjectWithContextMenu
Generates the context menu. The typical implementation isreturn new ContextMenu().from(this,request,response);
, which implements the default behaviour. SeeModelObjectWithContextMenu.ContextMenu.from(ModelObjectWithContextMenu, StaplerRequest2, StaplerResponse2)
for more details of what it does. This should suit most implementations.- Specified by:
doContextMenu
in interfaceModelObjectWithContextMenu
- Throws:
IOException
org.apache.commons.jelly.JellyException
-
doChildrenContextMenu
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws Exception Description copied from interface:ModelObjectWithChildren
Generates the context menu to list up all the children.- Specified by:
doChildrenContextMenu
in interfaceModelObjectWithChildren
- Throws:
Exception
-
getHeapDump
Obtains the heap dump.- Throws:
IOException
-
doSimulateOutOfMemory
Simulates OutOfMemoryError. Useful to make sure OutOfMemoryHeapDump setting.- Throws:
IOException
-
doUserContent
Binds /userContent/... to $JENKINS_HOME/userContent. -
doRestart
@CLIMethod(name="restart") public void doRestart(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Perform a restart of Jenkins, if we can. This first replaces "app" toHudsonIsRestarting
- Throws:
IOException
jakarta.servlet.ServletException
RestartNotSupportedException
-
generateNotFoundResponse
@WebMethod(name="404") @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void generateNotFoundResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws jakarta.servlet.ServletException, IOException Serve a custom 404 error page, configured in web.xml.- Throws:
jakarta.servlet.ServletException
IOException
-
doSafeRestart
@Deprecated(since="2.414") public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Deprecated.usedoSafeRestart(StaplerRequest2, String)
instead.Queues up a safe restart of Jenkins. Builds that cannot continue while the controller is not running have to finish or pause before it can proceed. No new builds will be started. No new jobs are accepted.- Throws:
IOException
jakarta.servlet.ServletException
RestartNotSupportedException
-
doSafeRestart
public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest2 req, @QueryParameter("message") String message) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.- Throws:
IOException
jakarta.servlet.ServletException
RestartNotSupportedException
- Since:
- 2.475
-
doSafeRestart
@Deprecated @StaplerNotDispatchable public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req, @QueryParameter("message") String message) throws IOException, javax.servlet.ServletException, RestartNotSupportedException Deprecated.- Throws:
IOException
javax.servlet.ServletException
RestartNotSupportedException
- Since:
- 2.414
-
restart
Performs a restart.- Throws:
RestartNotSupportedException
-
safeRestart
Deprecated.usesafeRestart(String)
instead.Queues up a restart to be performed once there are no builds currently running.- Throws:
RestartNotSupportedException
- Since:
- 1.332
-
safeRestart
Queues up a restart to be performed once there are no builds currently running.- Parameters:
message
- the message to show to users in the shutdown banner.- Throws:
RestartNotSupportedException
- Since:
- 2.414
-
doExit
@CLIMethod(name="shutdown") public void doExit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Shutdown the system.- Throws:
IOException
- Since:
- 1.161
-
doSafeExit
@CLIMethod(name="safe-shutdown") public org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest2 req) throws IOException Shutdown the system safely.- Throws:
IOException
- Since:
- 1.332
-
doSafeExit
@Deprecated @StaplerNotDispatchable public org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest req) throws IOException Deprecated.- Throws:
IOException
-
getAuthentication2
@NonNull public static org.springframework.security.core.Authentication getAuthentication2()Gets theAuthentication
object that represents the user associated with the current request.- Since:
- 2.266
-
getAuthentication
Deprecated. -
doScript
public void doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException For system diagnostics. Run arbitrary Groovy script.- Throws:
IOException
jakarta.servlet.ServletException
-
doScript
@Deprecated @StaplerNotDispatchable public void doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOException
javax.servlet.ServletException
-
doScriptText
public void doScriptText(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Run arbitrary Groovy script and return result as plain text.- Throws:
IOException
jakarta.servlet.ServletException
-
doScriptText
@Deprecated @StaplerNotDispatchable public void doScriptText(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOException
javax.servlet.ServletException
-
_doScript
public static void _doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, jakarta.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
- Since:
- 2.475
-
_doScript
@Deprecated public static void _doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, javax.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOException
javax.servlet.ServletException
- Since:
- 1.509.1
-
doEval
public void doEval(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Evaluates the Jelly script submitted by the client. This is useful for system administration as well as unit testing.- Throws:
IOException
jakarta.servlet.ServletException
-
doSignup
public void doSignup(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Sign up for the user account.- Throws:
IOException
jakarta.servlet.ServletException
-
doIconSize
public void doIconSize(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Changes the icon size by changing the cookie- Throws:
IOException
jakarta.servlet.ServletException
-
doFingerprintCleanup
- Throws:
IOException
-
doWorkspaceCleanup
- Throws:
IOException
-
doDefaultJDKCheck
public FormValidation doDefaultJDKCheck(org.kohsuke.stapler.StaplerRequest2 request, @QueryParameter String value) If the user chose the default JDK, make sure we got 'java' in PATH. -
doCheckViewName
Checks if a top-level view with the given name exists and make sure that the name is good as a view name. -
doViewExistsCheck
Deprecated.1.512Checks if a top-level view with the given name exists. -
doResources
public void doResources(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Serves static resources placed along with Jelly view files.This method can serve a lot of files, so care needs to be taken to make this method secure. It's not clear to me what's the best strategy here, though the current implementation is based on file extensions.
- Throws:
IOException
jakarta.servlet.ServletException
-
doCheckURIEncoding
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.37") @Deprecated public FormValidation doCheckURIEncoding(org.kohsuke.stapler.StaplerRequest2 request) throws IOException Deprecated.Checks if container uses UTF-8 to decode URLs. See http://wiki.jenkins-ci.org/display/JENKINS/Tomcat#Tomcat-i18n- Throws:
IOException
-
isCheckURIEncodingEnabled
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.37") @Deprecated public static boolean isCheckURIEncodingEnabled()Deprecated.Does not check when system default encoding is "ISO-8859-1". -
getFutureDependencyGraph
-
rebuildDependencyGraph
public void rebuildDependencyGraph()Rebuilds the dependency map. -
rebuildDependencyGraphAsync
Rebuilds the dependency map asynchronously.This would keep the UI thread more responsive and helps avoid the deadlocks, as dependency graph recomputation tends to touch a lot of other things.
- Since:
- 1.522
-
getDependencyGraph
-
getManagementLinks
-
getCategorizedManagementLinks
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Map<ManagementLink.Category,List<ManagementLink>> getCategorizedManagementLinks() -
getSetupWizard
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public SetupWizard getSetupWizard()If set, a currently active setup wizard - e.g. installation- Since:
- 2.0
-
getMe
Exposes the current user to/me
URL. -
getWidgets
Gets theWidget
s registered on this object.Plugins who wish to contribute boxes on the side panel can add widgets by
getWidgets().add(new MyWidget())
fromPlugin.start()
. -
getTarget
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
isSubjectToMandatoryReadPermissionCheck
Test a path to see if it is subject to mandatory read permission checks by container-managed security- Parameters:
restOfPath
- the URI, excluding the Jenkins root URI and query string- Returns:
- true if the path is subject to mandatory read permission checks
- Since:
- 2.37
-
getUnprotectedRootActions
Gets a list of unprotected root actions. These URL prefixes should be exempted from access control checks by container-managed security. Ideally would be synchronized withgetTarget()
.- Returns:
- a list of URL names
- Since:
- 1.495
-
getStaplerFallback
Fallback to the primary view.- Specified by:
getStaplerFallback
in interfaceorg.kohsuke.stapler.StaplerFallback
-
doCheckDisplayName
@Deprecated public FormValidation doCheckDisplayName(@QueryParameter String displayName, @QueryParameter String jobName) Checks to see if the candidate displayName collides with any existing display names or project names- Parameters:
displayName
- The display name to testjobName
- The name of the job the user is configuring
-
checkDisplayName
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation checkDisplayName(String displayName, TopLevelItem item) Checks to see if the candidate displayName collides with any existing display names or project names in the items parent group- Parameters:
displayName
- The display name to testitem
- The item to check for duplicates
-
lookup
Shortcut forJenkins.getInstanceOrNull()?.lookup.get(type)
-
getVersion
ParsesVERSION
intoVersionNumber
, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run
) -
getStoredVersion
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public static VersionNumber getStoredVersion()Get the stored version of Jenkins, as stored bydoConfigSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2)
.Parses the version into
VersionNumber
, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run
)- Since:
- 2.0
-
shouldShowStackTrace
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean shouldShowStackTrace()
-
ANONYMOUS2